﻿namespace UnityEditor
{
    using System;
    using System.Collections;
    using System.Collections.Generic;
    using System.IO;
    using System.Text.RegularExpressions;
    using UnityEditorInternal;
    using UnityEngine;

    [CustomEditor(typeof(PlayerSettings))]
    internal class PlayerSettingsEditor : Editor
    {
        private const int kIconSpacing = 6;
        private const int kMaxPreviewSize = 0x60;
        private const int kSlotSize = 60;
        private const float kThumbnailLabelHeight = 20f;
        private const float kThumbnailPadding = 5f;
        private const float kThumbnailSize = 80f;
        private const string kWebPlayerTemplateDefaultIconResource = "BuildSettings.Web.Small";
        private const float kWebPlayerTemplateGridPadding = 15f;
        private SerializedProperty m_AccelerometerFrequency;
        private SerializedProperty m_ActiveColorSpace;
        private SerializedProperty m_AllowedAutoRotateToLandscapeLeft;
        private SerializedProperty m_AllowedAutoRotateToLandscapeRight;
        private SerializedProperty m_AllowedAutoRotateToPortrait;
        private SerializedProperty m_AllowedAutoRotateToPortraitUpsideDown;
        private SerializedProperty m_AndroidBundleVersionCode;
        private SerializedProperty m_AndroidKeyaliasName;
        private SerializedProperty m_AndroidKeystoreName;
        private SerializedProperty m_AndroidMinSdkVersion;
        private SerializedProperty m_AndroidPreferredInstallLocation;
        private SerializedProperty m_AndroidProfiler;
        private SerializedProperty m_androidShowActivityIndicatorOnLoading;
        private SerializedProperty m_AndroidSplashScreenScale;
        private SerializedProperty m_AndroidTargetDevice;
        private AnimValueManager m_Anims = new AnimValueManager();
        private SerializedProperty m_AotOptions;
        private SerializedProperty m_ApiCompatibilityLevel;
        private SerializedProperty m_APKExpansionFiles;
        private SerializedProperty m_CaptureSingleScreen;
        private SerializedProperty m_CompanyName;
        private SerializedProperty m_CreateWallpaper;
        private SerializedProperty m_CursorHotspot;
        private SerializedProperty m_DefaultCursor;
        private SerializedProperty m_DefaultIsFullScreen;
        private SerializedProperty m_DefaultScreenHeight;
        private SerializedProperty m_DefaultScreenHeightWeb;
        private SerializedProperty m_DefaultScreenOrientation;
        private SerializedProperty m_DefaultScreenWidth;
        private SerializedProperty m_DefaultScreenWidthWeb;
        private SerializedProperty m_DisplayResolutionDialog;
        private SerializedProperty m_FirstStreamedLevelWithResources;
        private SerializedProperty m_FlashStrippingLevel;
        private SerializedProperty m_ForceInternetPermission;
        private SerializedProperty m_ForceSDCardPermission;
        private SerializedProperty m_iosShowActivityIndicatorOnLoading;
        private SerializedProperty m_IPadHighResLandscapeSplashScreen;
        private SerializedProperty m_IPadHighResPortraitSplashScreen;
        private SerializedProperty m_IPadLandscapeSplashScreen;
        private SerializedProperty m_IPadPortraitSplashScreen;
        private SerializedProperty m_IPhoneApplicationDisplayName;
        private SerializedProperty m_IPhoneBundleIdentifier;
        private SerializedProperty m_IPhoneBundleVersion;
        private SerializedProperty m_IPhoneHighResSplashScreen;
        private SerializedProperty m_IPhoneScriptCallOptimization;
        private SerializedProperty m_IPhoneSdkVersion;
        private SerializedProperty m_IPhoneSplashScreen;
        private SerializedProperty m_IPhoneStrippingLevel;
        private SerializedProperty m_IPhoneTallHighResSplashScreen;
        private SerializedProperty m_IPhoneTargetOSVersion;
        private string[] m_KeystoreAvailableKeys;
        private string m_KeystoreConfirm = string.Empty;
        private bool m_KeystoreCreate;
        private SerializedProperty m_MacFullscreenMode;
        private SerializedProperty m_MTRendering;
        private SerializedProperty m_OverrideIPodMusic;
        private SerializedProperty m_ProductName;
        private SerializedProperty m_PS3BackgroundPath;
        private SerializedProperty m_PS3BootCheckMaxSaveGameSizeKB;
        private SerializedProperty m_PS3DLCConfigPath;
        private SerializedProperty m_PS3SaveGameSlots;
        private SerializedProperty m_PS3SoundPath;
        private SerializedProperty m_PS3ThumbnailPath;
        private SerializedProperty m_PS3TitleConfigPath;
        private SerializedProperty m_PS3TrialMode;
        private SerializedProperty m_PS3TrophyCommId;
        private SerializedProperty m_PS3TrophyCommSig;
        private SerializedProperty m_PS3TrophyPackagePath;
        private SerializedProperty m_RenderingPath;
        private SerializedProperty m_ResizableWindow;
        private SerializedProperty m_ResolutionDialogBanner;
        private SerializedProperty m_RunInBackground;
        private AnimBool[] m_SectionAnimators = new AnimBool[5];
        private SavedInt m_SelectedSection = new SavedInt("PlayerSettings.ShownSection", -1);
        private readonly AnimBool m_ShowDeferredWarning = new AnimBool();
        private SerializedProperty m_StripPhysics;
        private SerializedProperty m_StripUnusedMeshComponents;
        private SerializedProperty m_SupportedAspectRatios;
        private SerializedProperty m_TargetDevice;
        private SerializedProperty m_TargetGlesGraphics;
        private SerializedProperty m_TargetResolution;
        private SerializedProperty m_UIExitOnSuspend;
        private SerializedProperty m_UIPrerenderedIcon;
        private SerializedProperty m_UIRequiresPersistentWiFi;
        private SerializedProperty m_UIStatusBarHidden;
        private SerializedProperty m_UIStatusBarStyle;
        private SerializedProperty m_Use24BitDepthBuffer;
        private SerializedProperty m_Use32BitDisplayBuffer;
        private SerializedProperty m_UseDX11;
        private SerializedProperty m_UseMacAppStoreValidation;
        private SerializedProperty m_UseOSAutoRotation;
        private SerializedProperty m_UsePlayerLog;
        private SerializedProperty m_WebPlayerTemplate;
        private SerializedProperty m_WiiCompanyCode;
        private SerializedProperty m_WiiControllerCount;
        private SerializedProperty m_WiiFloatingPointExceptions;
        private SerializedProperty m_WiiGameCode;
        private SerializedProperty m_WiiGameVersion;
        private SerializedProperty m_WiiHio2Usage;
        private SerializedProperty m_WiiLoadingScreenBackground;
        private SerializedProperty m_WiiLoadingScreenFileName;
        private SerializedProperty m_WiiLoadingScreenPeriod;
        private SerializedProperty m_WiiLoadingScreenRect;
        private SerializedProperty m_WiiLoadingScreenRectPlacement;
        private SerializedProperty m_WiiRegion;
        private SerializedProperty m_WiiScreenCrashDumps;
        private SerializedProperty m_WiiSupportsBalanceBoard;
        private SerializedProperty m_WiiSupportsClassicController;
        private SerializedProperty m_WiiSupportsMotionPlus;
        private SerializedProperty m_WiiSupportsNunchuk;
        private SerializedProperty m_XboxAdditionalTitleMemorySize;
        private SerializedProperty m_XboxDeployKinectResources;
        private SerializedProperty m_XboxEnableAvatar;
        private SerializedProperty m_XboxEnableFitness;
        private SerializedProperty m_XboxEnableKinect;
        private SerializedProperty m_XboxEnableKinectAutoTracking;
        private SerializedProperty m_XboxEnableSpeech;
        private SerializedProperty m_XboxGenerateSpa;
        private SerializedProperty m_XboxImageXexPath;
        private SerializedProperty m_XboxSkinOnGPU;
        private SerializedProperty m_XboxSpaPath;
        private SerializedProperty m_XboxSpeechDB;
        private SerializedProperty m_XboxSplashScreen;
        private SerializedProperty m_XboxTitleId;
        private Vector2 memSetupScrollPosition = new Vector2(0f, 0f);
        private static Styles s_Styles;
        private static Texture2D s_WarningIcon;
        private int scriptingDefinesControlID;
        private int selectedPlatform;
        private BuildPlayerWindow.BuildPlatform[] validPlatforms;

        private void AutoAssignProperty(SerializedProperty property, string packageDir, string fileName)
        {
            if (((property.stringValue.Length == 0) || !File.Exists(Path.Combine(packageDir, property.stringValue))) && File.Exists(Path.Combine(packageDir, fileName)))
            {
                property.stringValue = fileName;
            }
        }

        private bool BeginSettingsBox(int nr, GUIContent header)
        {
            bool enabled = GUI.enabled;
            GUI.enabled = true;
            EditorGUILayout.BeginVertical(EditorStyles.helpBox, new GUILayoutOption[0]);
            Rect position = GUILayoutUtility.GetRect((float) 20f, (float) 18f);
            position.x += 3f;
            position.width += 6f;
            bool flag2 = GUI.Toggle(position, this.m_SelectedSection.value == nr, header, EditorStyles.inspectorTitlebarText);
            if (GUI.changed)
            {
                this.m_SelectedSection.value = !flag2 ? -1 : nr;
            }
            this.m_SectionAnimators[nr].target = flag2;
            GUI.enabled = enabled;
            return EditorGUILayout.BeginFadeGroup(this.m_SectionAnimators[nr].faded);
        }

        private void CommonSettings()
        {
            EditorGUILayout.PropertyField(this.m_CompanyName, new GUILayoutOption[0]);
            EditorGUILayout.PropertyField(this.m_ProductName, new GUILayoutOption[0]);
            EditorGUILayout.Space();
            GUI.changed = false;
            string platform = string.Empty;
            Texture2D[] iconsForPlatform = PlayerSettings.GetIconsForPlatform(platform);
            int[] iconSizesForPlatform = PlayerSettings.GetIconSizesForPlatform(platform);
            if (iconsForPlatform.Length != iconSizesForPlatform.Length)
            {
                iconsForPlatform = new Texture2D[iconSizesForPlatform.Length];
                PlayerSettings.SetIconsForPlatform(platform, iconsForPlatform);
            }
            iconsForPlatform[0] = (Texture2D) EditorGUILayout.ObjectField(s_Styles.defaultIcon, iconsForPlatform[0], typeof(Texture2D), false, new GUILayoutOption[0]);
            if (GUI.changed)
            {
                PlayerSettings.SetIconsForPlatform(platform, iconsForPlatform);
            }
            GUILayout.Space(3f);
            this.m_DefaultCursor.objectReferenceValue = EditorGUILayout.ObjectField(s_Styles.defaultCursor, this.m_DefaultCursor.objectReferenceValue, typeof(Texture2D), false, new GUILayoutOption[0]);
            Rect position = EditorGUI.PrefixLabel(EditorGUILayout.GetControlRect(true, 16f, EditorStyles.numberField, null), 0, s_Styles.cursorHotspot);
            float labelWidth = EditorGUIUtility.labelWidth;
            EditorGUIUtility.labelWidth = 15f;
            EditorGUI.BeginChangeCheck();
            position.width /= 2f;
            float x = EditorGUI.FloatField(position, "X", this.m_CursorHotspot.vector2Value.x);
            position.x += position.width;
            float y = EditorGUI.FloatField(position, "Y", this.m_CursorHotspot.vector2Value.y);
            if (EditorGUI.EndChangeCheck())
            {
                this.m_CursorHotspot.vector2Value = new Vector2(x, y);
            }
            EditorGUIUtility.labelWidth = labelWidth;
        }

        private void EndSettingsBox()
        {
            EditorGUILayout.EndFadeGroup();
            EditorGUILayout.EndVertical();
        }

        private SerializedProperty FindPropertyAssert(string name)
        {
            SerializedProperty property = base.serializedObject.FindProperty(name);
            if (property == null)
            {
                Debug.LogError("Failed to find:" + name);
            }
            return property;
        }

        private void IconSectionGUI(int selectedPlatform)
        {
            GUI.changed = false;
            if (this.BeginSettingsBox(1, EditorGUIUtility.TextContent("PlayerSettings.IconHeader")))
            {
                bool flag = selectedPlatform < 0;
                BuildPlayerWindow.BuildPlatform platform = null;
                BuildTargetGroup standalone = BuildTargetGroup.Standalone;
                string name = string.Empty;
                if (!flag)
                {
                    platform = this.validPlatforms[selectedPlatform];
                    standalone = platform.targetGroup;
                    name = platform.name;
                }
                bool enabled = GUI.enabled;
                switch (standalone)
                {
                    case BuildTargetGroup.XBOX360:
                    case BuildTargetGroup.FlashPlayer:
                    case BuildTargetGroup.WebPlayer:
                        this.ShowNoSettings();
                        EditorGUILayout.Space();
                        goto Label_02EB;
                }
                Texture2D[] iconsForPlatform = PlayerSettings.GetIconsForPlatform(name);
                int[] iconSizesForPlatform = PlayerSettings.GetIconSizesForPlatform(name);
                bool flag3 = true;
                if (flag)
                {
                    if (iconsForPlatform.Length != iconSizesForPlatform.Length)
                    {
                        iconsForPlatform = new Texture2D[iconSizesForPlatform.Length];
                        PlayerSettings.SetIconsForPlatform(name, iconsForPlatform);
                    }
                }
                else
                {
                    GUI.changed = false;
                    flag3 = iconsForPlatform.Length == iconSizesForPlatform.Length;
                    flag3 = GUILayout.Toggle(flag3, "Override for " + platform.name, new GUILayoutOption[0]);
                    GUI.enabled = enabled && flag3;
                    if (GUI.changed || (!flag3 && (iconsForPlatform.Length > 0)))
                    {
                        if (flag3)
                        {
                            iconsForPlatform = new Texture2D[iconSizesForPlatform.Length];
                        }
                        else
                        {
                            iconsForPlatform = new Texture2D[0];
                        }
                        PlayerSettings.SetIconsForPlatform(name, iconsForPlatform);
                    }
                }
                GUI.changed = false;
                for (int i = 0; i < iconSizesForPlatform.Length; i++)
                {
                    int b = Mathf.Min(0x60, iconSizesForPlatform[i]);
                    Rect rect = GUILayoutUtility.GetRect(60f, (float) (Mathf.Max(60, b) + 6));
                    float num3 = Mathf.Min(rect.width, (((EditorGUIUtility.labelWidth + 4f) + 60f) + 6f) + 96f);
                    string text = iconSizesForPlatform[i] + "x" + iconSizesForPlatform[i];
                    GUI.Label(new Rect(rect.x, rect.y, ((num3 - 96f) - 60f) - 12f, 20f), text);
                    if (flag3)
                    {
                        iconsForPlatform[i] = (Texture2D) EditorGUI.ObjectField(new Rect((((rect.x + num3) - 96f) - 60f) - 6f, rect.y, 60f, 60f), iconsForPlatform[i], typeof(Texture2D), false);
                    }
                    Rect position = new Rect((rect.x + num3) - 96f, rect.y, (float) b, (float) b);
                    Texture2D iconForPlatformAtSize = PlayerSettings.GetIconForPlatformAtSize(name, iconSizesForPlatform[i]);
                    if (iconForPlatformAtSize != null)
                    {
                        GUI.DrawTexture(position, iconForPlatformAtSize);
                    }
                    else
                    {
                        GUI.Box(position, string.Empty);
                    }
                }
                if (GUI.changed)
                {
                    PlayerSettings.SetIconsForPlatform(name, iconsForPlatform);
                }
                GUI.enabled = enabled;
                if (standalone == BuildTargetGroup.iPhone)
                {
                    EditorGUILayout.PropertyField(this.m_UIPrerenderedIcon, EditorGUIUtility.TextContent("PlayerSettings.UIPrerenderedIcon"), new GUILayoutOption[0]);
                    EditorGUILayout.Space();
                }
            }
        Label_02EB:
            this.EndSettingsBox();
        }

        private void OnDisable()
        {
            WebPlayerTemplate.ClearTemplates();
        }

        private void OnEnable()
        {
            this.validPlatforms = BuildPlayerWindow.GetValidPlatforms().ToArray();
            this.m_PS3TitleConfigPath = this.FindPropertyAssert("ps3TitleConfigPath");
            this.m_PS3DLCConfigPath = this.FindPropertyAssert("ps3DLCConfigPath");
            this.m_PS3ThumbnailPath = this.FindPropertyAssert("ps3ThumbnailPath");
            this.m_PS3BackgroundPath = this.FindPropertyAssert("ps3BackgroundPath");
            this.m_PS3SoundPath = this.FindPropertyAssert("ps3SoundPath");
            this.m_PS3TrophyCommId = this.FindPropertyAssert("ps3TrophyCommId");
            this.m_PS3TrophyPackagePath = this.FindPropertyAssert("ps3TrophyPackagePath");
            this.m_PS3BootCheckMaxSaveGameSizeKB = this.FindPropertyAssert("ps3BootCheckMaxSaveGameSizeKB");
            this.m_PS3TrophyCommSig = this.FindPropertyAssert("ps3TrophyCommSig");
            this.m_PS3TrialMode = this.FindPropertyAssert("ps3TrialMode");
            this.m_PS3SaveGameSlots = this.FindPropertyAssert("ps3SaveGameSlots");
            this.m_IPhoneSdkVersion = this.FindPropertyAssert("iPhoneSdkVersion");
            this.m_IPhoneTargetOSVersion = this.FindPropertyAssert("iPhoneTargetOSVersion");
            this.m_IPhoneStrippingLevel = this.FindPropertyAssert("iPhoneStrippingLevel");
            this.m_IPhoneScriptCallOptimization = this.FindPropertyAssert("iPhoneScriptCallOptimization");
            this.m_AndroidProfiler = this.FindPropertyAssert("AndroidProfiler");
            this.m_ForceInternetPermission = this.FindPropertyAssert("ForceInternetPermission");
            this.m_ForceSDCardPermission = this.FindPropertyAssert("ForceSDCardPermission");
            this.m_CreateWallpaper = this.FindPropertyAssert("CreateWallpaper");
            this.m_CompanyName = this.FindPropertyAssert("companyName");
            this.m_ProductName = this.FindPropertyAssert("productName");
            this.m_DefaultCursor = this.FindPropertyAssert("defaultCursor");
            this.m_CursorHotspot = this.FindPropertyAssert("cursorHotspot");
            this.m_UIPrerenderedIcon = this.FindPropertyAssert("uIPrerenderedIcon");
            this.m_ResolutionDialogBanner = this.FindPropertyAssert("resolutionDialogBanner");
            this.m_IPhoneSplashScreen = this.FindPropertyAssert("iPhoneSplashScreen");
            this.m_IPhoneHighResSplashScreen = this.FindPropertyAssert("iPhoneHighResSplashScreen");
            this.m_IPhoneTallHighResSplashScreen = this.FindPropertyAssert("iPhoneTallHighResSplashScreen");
            this.m_IPadPortraitSplashScreen = this.FindPropertyAssert("iPadPortraitSplashScreen");
            this.m_IPadHighResPortraitSplashScreen = this.FindPropertyAssert("iPadHighResPortraitSplashScreen");
            this.m_IPadLandscapeSplashScreen = this.FindPropertyAssert("iPadLandscapeSplashScreen");
            this.m_IPadHighResLandscapeSplashScreen = this.FindPropertyAssert("iPadHighResLandscapeSplashScreen");
            this.m_AndroidSplashScreenScale = this.FindPropertyAssert("AndroidSplashScreenScale");
            this.m_AndroidKeystoreName = this.FindPropertyAssert("AndroidKeystoreName");
            this.m_AndroidKeyaliasName = this.FindPropertyAssert("AndroidKeyaliasName");
            this.m_UIStatusBarHidden = this.FindPropertyAssert("uIStatusBarHidden");
            this.m_UIStatusBarStyle = this.FindPropertyAssert("uIStatusBarStyle");
            this.m_RenderingPath = this.FindPropertyAssert("m_RenderingPath");
            this.m_ActiveColorSpace = this.FindPropertyAssert("m_ActiveColorSpace");
            this.m_MTRendering = this.FindPropertyAssert("m_MTRendering");
            this.m_StripUnusedMeshComponents = this.FindPropertyAssert("StripUnusedMeshComponents");
            this.m_UseDX11 = this.FindPropertyAssert("m_UseDX11");
            this.m_FirstStreamedLevelWithResources = this.FindPropertyAssert("firstStreamedLevelWithResources");
            this.m_IPhoneBundleIdentifier = this.FindPropertyAssert("iPhoneBundleIdentifier");
            this.m_IPhoneBundleVersion = this.FindPropertyAssert("iPhoneBundleVersion");
            this.m_AndroidBundleVersionCode = this.FindPropertyAssert("AndroidBundleVersionCode");
            this.m_AndroidMinSdkVersion = this.FindPropertyAssert("AndroidMinSdkVersion");
            this.m_AndroidPreferredInstallLocation = this.FindPropertyAssert("AndroidPreferredInstallLocation");
            this.m_TargetResolution = this.FindPropertyAssert("targetResolution");
            this.m_AccelerometerFrequency = this.FindPropertyAssert("accelerometerFrequency");
            this.m_OverrideIPodMusic = this.FindPropertyAssert("Override IPod Music");
            this.m_UIRequiresPersistentWiFi = this.FindPropertyAssert("uIRequiresPersistentWiFi");
            this.m_UIExitOnSuspend = this.FindPropertyAssert("uIExitOnSuspend");
            this.m_AndroidTargetDevice = this.FindPropertyAssert("AndroidTargetDevice");
            this.m_ApiCompatibilityLevel = this.FindPropertyAssert("apiCompatibilityLevel");
            this.m_AotOptions = this.FindPropertyAssert("aotOptions");
            this.m_APKExpansionFiles = this.FindPropertyAssert("APKExpansionFiles");
            this.m_DefaultScreenWidth = this.FindPropertyAssert("defaultScreenWidth");
            this.m_DefaultScreenHeight = this.FindPropertyAssert("defaultScreenHeight");
            this.m_DefaultScreenWidthWeb = this.FindPropertyAssert("defaultScreenWidthWeb");
            this.m_DefaultScreenHeightWeb = this.FindPropertyAssert("defaultScreenHeightWeb");
            this.m_RunInBackground = this.FindPropertyAssert("runInBackground");
            this.m_DefaultScreenOrientation = this.FindPropertyAssert("defaultScreenOrientation");
            this.m_AllowedAutoRotateToPortrait = this.FindPropertyAssert("allowedAutorotateToPortrait");
            this.m_AllowedAutoRotateToPortraitUpsideDown = this.FindPropertyAssert("allowedAutorotateToPortraitUpsideDown");
            this.m_AllowedAutoRotateToLandscapeRight = this.FindPropertyAssert("allowedAutorotateToLandscapeRight");
            this.m_AllowedAutoRotateToLandscapeLeft = this.FindPropertyAssert("allowedAutorotateToLandscapeLeft");
            this.m_UseOSAutoRotation = this.FindPropertyAssert("useOSAutorotation");
            this.m_Use32BitDisplayBuffer = this.FindPropertyAssert("use32BitDisplayBuffer");
            this.m_Use24BitDepthBuffer = this.FindPropertyAssert("use24BitDepthBuffer");
            this.m_iosShowActivityIndicatorOnLoading = this.FindPropertyAssert("iosShowActivityIndicatorOnLoading");
            this.m_androidShowActivityIndicatorOnLoading = this.FindPropertyAssert("androidShowActivityIndicatorOnLoading");
            this.m_DefaultIsFullScreen = this.FindPropertyAssert("defaultIsFullScreen");
            this.m_CaptureSingleScreen = this.FindPropertyAssert("captureSingleScreen");
            this.m_DisplayResolutionDialog = this.FindPropertyAssert("displayResolutionDialog");
            this.m_SupportedAspectRatios = this.FindPropertyAssert("m_SupportedAspectRatios");
            this.m_WebPlayerTemplate = this.FindPropertyAssert("webPlayerTemplate");
            this.m_TargetGlesGraphics = this.FindPropertyAssert("targetGlesGraphics");
            this.m_TargetDevice = this.FindPropertyAssert("targetDevice");
            this.m_UsePlayerLog = this.FindPropertyAssert("usePlayerLog");
            this.m_ResizableWindow = this.FindPropertyAssert("resizableWindow");
            this.m_StripPhysics = this.FindPropertyAssert("stripPhysics");
            this.m_UseMacAppStoreValidation = this.FindPropertyAssert("useMacAppStoreValidation");
            this.m_MacFullscreenMode = this.FindPropertyAssert("macFullscreenMode");
            this.m_XboxTitleId = this.FindPropertyAssert("XboxTitleId");
            this.m_XboxImageXexPath = this.FindPropertyAssert("XboxImageXexPath");
            this.m_XboxSpaPath = this.FindPropertyAssert("XboxSpaPath");
            this.m_XboxGenerateSpa = this.FindPropertyAssert("XboxGenerateSpa");
            this.m_XboxDeployKinectResources = this.FindPropertyAssert("XboxDeployKinectResources");
            this.m_XboxSkinOnGPU = this.FindPropertyAssert("xboxSkinOnGPU");
            this.m_XboxEnableAvatar = this.FindPropertyAssert("xboxEnableAvatar");
            this.m_XboxEnableKinect = this.FindPropertyAssert("xboxEnableKinect");
            this.m_XboxEnableKinectAutoTracking = this.FindPropertyAssert("xboxEnableKinectAutoTracking");
            this.m_XboxSplashScreen = this.FindPropertyAssert("XboxSplashScreen");
            this.m_XboxEnableSpeech = this.FindPropertyAssert("xboxEnableSpeech");
            this.m_XboxSpeechDB = this.FindPropertyAssert("xboxSpeechDB");
            this.m_XboxEnableFitness = this.FindPropertyAssert("xboxEnableFitness");
            this.m_XboxAdditionalTitleMemorySize = this.FindPropertyAssert("xboxAdditionalTitleMemorySize");
            this.m_WiiSupportsNunchuk = this.FindPropertyAssert("wiiSupportsNunchuk");
            this.m_WiiSupportsClassicController = this.FindPropertyAssert("wiiSupportsClassicController");
            this.m_WiiSupportsBalanceBoard = this.FindPropertyAssert("wiiSupportsBalanceBoard");
            this.m_WiiSupportsMotionPlus = this.FindPropertyAssert("wiiSupportsMotionPlus");
            this.m_WiiControllerCount = this.FindPropertyAssert("wiiControllerCount");
            this.m_WiiFloatingPointExceptions = this.FindPropertyAssert("wiiFloatingPointExceptions");
            this.m_WiiScreenCrashDumps = this.FindPropertyAssert("wiiScreenCrashDumps");
            this.m_WiiHio2Usage = this.FindPropertyAssert("wiiHio2Usage");
            this.m_WiiLoadingScreenRectPlacement = this.FindPropertyAssert("wiiLoadingScreenRectPlacement");
            this.m_WiiLoadingScreenPeriod = this.FindPropertyAssert("wiiLoadingScreenPeriod");
            this.m_WiiLoadingScreenFileName = this.FindPropertyAssert("wiiLoadingScreenFileName");
            this.m_WiiLoadingScreenRect = this.FindPropertyAssert("wiiLoadingScreenRect");
            this.m_WiiLoadingScreenBackground = this.FindPropertyAssert("wiiLoadingScreenBackground");
            this.m_FlashStrippingLevel = this.FindPropertyAssert("flashStrippingLevel");
            for (int i = 0; i < this.m_SectionAnimators.Length; i++)
            {
                AnimBool v = this.m_SectionAnimators[i] = new AnimBool();
                v.value = this.m_SelectedSection.value == i;
                this.m_Anims.Add(v);
            }
            this.m_ShowDeferredWarning.value = !InternalEditorUtility.HasPro() && (PlayerSettings.renderingPath == RenderingPath.DeferredLighting);
            this.m_Anims.Add(this.m_ShowDeferredWarning);
        }

        public override void OnInspectorGUI()
        {
            if (s_Styles == null)
            {
                s_Styles = new Styles();
            }
            if (this.m_Anims.callback == null)
            {
                this.m_Anims.callback = new AnimValueManager.Callback(this.Repaint);
            }
            base.serializedObject.Update();
            this.m_ShowDeferredWarning.target = !InternalEditorUtility.HasPro() && (PlayerSettings.renderingPath == RenderingPath.DeferredLighting);
            EditorGUIUtility.LookLikeControls(EditorGUIUtility.labelWidth + 40f);
            GUILayout.Label(EditorGUIUtility.TextContent("PlayerSettings.CrossPlatformHeader"), EditorStyles.boldLabel, new GUILayoutOption[0]);
            this.CommonSettings();
            GUILayout.Label(EditorGUIUtility.TextContent("PlayerSettings.PerPlatformHeader"), EditorStyles.boldLabel, new GUILayoutOption[0]);
            EditorGUI.BeginChangeCheck();
            int selectedPlatform = this.selectedPlatform;
            this.selectedPlatform = EditorGUILayout.BeginPlatformGrouping(this.validPlatforms, null);
            if (EditorGUI.EndChangeCheck())
            {
                if (EditorGUI.s_DelayedTextEditor.IsEditingControl(this.scriptingDefinesControlID))
                {
                    EditorGUI.EndEditingActiveTextField();
                    GUIUtility.keyboardControl = 0;
                    PlayerSettings.SetScriptingDefineSymbolsForGroup(this.validPlatforms[selectedPlatform].targetGroup, EditorGUI.s_DelayedTextEditor.content.text);
                }
                GUI.FocusControl(string.Empty);
            }
            GUILayout.Label("Settings for " + this.validPlatforms[this.selectedPlatform].title.text, new GUILayoutOption[0]);
            EditorGUIUtility.LookLikeControls(EditorGUIUtility.labelWidth - 12f);
            this.ResolutionSectionGUI(this.selectedPlatform);
            this.IconSectionGUI(this.selectedPlatform);
            this.SplashSectionGUI(this.selectedPlatform);
            this.OtherSectionGUI(this.selectedPlatform);
            this.PublishSectionGUI(this.selectedPlatform);
            EditorGUILayout.EndPlatformGrouping();
            base.serializedObject.ApplyModifiedProperties();
        }

        public void OtherSectionGUI(int selectedPlatform)
        {
            GUI.changed = false;
            if (this.BeginSettingsBox(3, EditorGUIUtility.TextContent("PlayerSettings.OtherHeader")))
            {
                int num;
                int num2;
                BuildPlayerWindow.BuildPlatform platform = this.validPlatforms[selectedPlatform];
                BuildTargetGroup targetGroup = platform.targetGroup;
                GUILayout.Label(EditorGUIUtility.TextContent("PlayerSettings.RenderingSubHeader"), EditorStyles.boldLabel, new GUILayoutOption[0]);
                if ((targetGroup == BuildTargetGroup.Standalone) || (targetGroup == BuildTargetGroup.WebPlayer))
                {
                    EditorGUILayout.PropertyField(this.m_RenderingPath, EditorGUIUtility.TextContent("PlayerSettings.RenderingPath"), new GUILayoutOption[0]);
                    if (EditorGUILayout.BeginFadeGroup(this.m_ShowDeferredWarning.faded))
                    {
                        EditorGUILayout.HelpBox(EditorGUIUtility.TextContent("CameraEditor.DeferredProOnly").text, MessageType.Warning, false);
                    }
                    EditorGUILayout.EndFadeGroup();
                }
                switch (targetGroup)
                {
                    case BuildTargetGroup.Standalone:
                    case BuildTargetGroup.WebPlayer:
                    case BuildTargetGroup.PS3:
                    case BuildTargetGroup.XBOX360:
                        EditorGUILayout.PropertyField(this.m_ActiveColorSpace, EditorGUIUtility.TextContent("PlayerSettings.ActiveColorSpace"), new GUILayoutOption[0]);
                        if (QualitySettings.activeColorSpace != QualitySettings.desiredColorSpace)
                        {
                            EditorGUILayout.HelpBox(s_Styles.colorSpaceWarning.text, MessageType.Warning);
                        }
                        break;
                }
                if (targetGroup == BuildTargetGroup.XBOX360)
                {
                    this.m_MTRendering.boolValue = EditorGUILayout.Toggle(EditorGUIUtility.TextContent("PlayerSettings.MultithreadedRendering"), this.m_MTRendering.boolValue, new GUILayoutOption[0]);
                }
                if ((targetGroup == BuildTargetGroup.Standalone) || (targetGroup == BuildTargetGroup.WebPlayer))
                {
                    bool flag = Application.platform == RuntimePlatform.WindowsEditor;
                    this.m_UseDX11.boolValue = EditorGUILayout.Toggle(EditorGUIUtility.TextContent("PlayerSettings.UseDX11"), this.m_UseDX11.boolValue, new GUILayoutOption[0]);
                    if (this.m_UseDX11.boolValue)
                    {
                        if (!flag)
                        {
                            EditorGUILayout.HelpBox(EditorGUIUtility.TextContent("PlayerSettings.DX11Warning").text, MessageType.Warning);
                        }
                        else if (!SystemInfo.graphicsDeviceVersion.StartsWith("Direct3D 11"))
                        {
                            EditorGUILayout.HelpBox(EditorGUIUtility.TextContent("PlayerSettings.DX11RestartWarning").text, MessageType.Warning);
                        }
                    }
                }
                bool flag2 = (targetGroup != BuildTargetGroup.Wii) && (targetGroup != BuildTargetGroup.PS3);
                bool flag3 = ((targetGroup != BuildTargetGroup.Wii) && (targetGroup != BuildTargetGroup.PS3)) && (targetGroup != BuildTargetGroup.XBOX360);
                PlayerSettings.GetBatchingForPlatform(platform.DefaultTarget, out num, out num2);
                bool flag4 = false;
                if (!flag2 && (num == 1))
                {
                    num = 0;
                    flag4 = true;
                }
                if (!flag3 && (num2 == 1))
                {
                    num2 = 0;
                    flag4 = true;
                }
                if (flag4)
                {
                    PlayerSettings.SetBatchingForPlatform(platform.DefaultTarget, num, num2);
                }
                EditorGUI.BeginDisabledGroup(!(InternalEditorUtility.HasAdvancedLicenseOnBuildTarget(platform.DefaultTarget) && flag2));
                if (GUI.enabled)
                {
                    num = !EditorGUILayout.Toggle(EditorGUIUtility.TextContent("PlayerSettings.StaticBatching"), num != 0, new GUILayoutOption[0]) ? 0 : 1;
                }
                else
                {
                    EditorGUILayout.Toggle(EditorGUIUtility.TextContent("PlayerSettings.StaticBatching"), false, new GUILayoutOption[0]);
                }
                EditorGUI.EndDisabledGroup();
                EditorGUI.BeginDisabledGroup(!flag3);
                num2 = !EditorGUILayout.Toggle(EditorGUIUtility.TextContent("PlayerSettings.DynamicBatching"), num2 != 0, new GUILayoutOption[0]) ? 0 : 1;
                EditorGUI.EndDisabledGroup();
                this.ShowAdvancedBatchingWarning(platform.DefaultTarget);
                if (GUI.changed)
                {
                    PlayerSettings.SetBatchingForPlatform(platform.DefaultTarget, num, num2);
                }
                if (targetGroup == BuildTargetGroup.XBOX360)
                {
                    this.m_XboxSkinOnGPU.boolValue = EditorGUILayout.Toggle("Enable GPU skinning", this.m_XboxSkinOnGPU.boolValue, new GUILayoutOption[0]);
                }
                EditorGUILayout.Space();
                if (targetGroup == BuildTargetGroup.WebPlayer)
                {
                    GUILayout.Label(EditorGUIUtility.TextContent("PlayerSettings.StreamingSubHeader"), EditorStyles.boldLabel, new GUILayoutOption[0]);
                    EditorGUILayout.PropertyField(this.m_FirstStreamedLevelWithResources, EditorGUIUtility.TextContent("PlayerSettings.FirstStreamedLevelWithResources"), new GUILayoutOption[0]);
                    EditorGUILayout.Space();
                }
                if ((targetGroup == BuildTargetGroup.iPhone) || (targetGroup == BuildTargetGroup.Android))
                {
                    GUILayout.Label(EditorGUIUtility.TextContent("PlayerSettings.IdentificationSubHeader"), EditorStyles.boldLabel, new GUILayoutOption[0]);
                    EditorGUILayout.PropertyField(this.m_IPhoneBundleIdentifier, EditorGUIUtility.TextContent("PlayerSettings.IPhoneBundleIdentifier"), new GUILayoutOption[0]);
                    EditorGUILayout.PropertyField(this.m_IPhoneBundleVersion, EditorGUIUtility.TextContent("PlayerSettings.IPhoneBundleVersion"), new GUILayoutOption[0]);
                    if (targetGroup == BuildTargetGroup.Android)
                    {
                        EditorGUILayout.PropertyField(this.m_AndroidBundleVersionCode, EditorGUIUtility.TextContent("PlayerSettings.AndroidBundleVersionCode"), new GUILayoutOption[0]);
                        EditorGUILayout.PropertyField(this.m_AndroidMinSdkVersion, EditorGUIUtility.TextContent("PlayerSettings.AndroidMinSdkVersion"), new GUILayoutOption[0]);
                    }
                    EditorGUILayout.Space();
                }
                if (targetGroup != BuildTargetGroup.FlashPlayer)
                {
                    GUILayout.Label(EditorGUIUtility.TextContent("PlayerSettings.ConfigurationSubHeader"), EditorStyles.boldLabel, new GUILayoutOption[0]);
                    if ((targetGroup == BuildTargetGroup.iPhone) || (targetGroup == BuildTargetGroup.Android))
                    {
                        if (targetGroup == BuildTargetGroup.iPhone)
                        {
                            EditorGUILayout.PropertyField(this.m_TargetDevice, new GUILayoutOption[0]);
                            if (((this.m_TargetDevice.intValue == 1) || (this.m_TargetDevice.intValue == 2)) && (this.m_IPhoneTargetOSVersion.intValue <= 6))
                            {
                                this.m_IPhoneTargetOSVersion.intValue = 7;
                            }
                            EditorGUILayout.PropertyField(this.m_TargetResolution, EditorGUIUtility.TextContent("PlayerSettings.TargetResolution"), new GUILayoutOption[0]);
                        }
                        if (targetGroup == BuildTargetGroup.Android)
                        {
                            EditorGUILayout.PropertyField(this.m_AndroidTargetDevice, EditorGUIUtility.TextContent("PlayerSettings.AndroidTargetDevice"), new GUILayoutOption[0]);
                            if (!this.m_CreateWallpaper.boolValue)
                            {
                                GUIContent label = EditorGUIUtility.TextContent("PlayerSettings.AndroidPreferredInstallLocation");
                                EditorGUILayout.PropertyField(this.m_AndroidPreferredInstallLocation, label, new GUILayoutOption[0]);
                            }
                        }
                        if ((targetGroup == BuildTargetGroup.iPhone) || (targetGroup == BuildTargetGroup.Android))
                        {
                            EditorGUILayout.PropertyField(this.m_TargetGlesGraphics, EditorGUIUtility.TextContent("PlayerSettings.TargetGlesGraphics"), new GUILayoutOption[0]);
                        }
                        if (targetGroup == BuildTargetGroup.iPhone)
                        {
                            EditorGUILayout.PropertyField(this.m_AccelerometerFrequency, EditorGUIUtility.TextContent("PlayerSettings.AccelerometerFrequency"), new GUILayoutOption[0]);
                        }
                        if (targetGroup == BuildTargetGroup.iPhone)
                        {
                            EditorGUILayout.PropertyField(this.m_OverrideIPodMusic, new GUILayoutOption[0]);
                            EditorGUILayout.PropertyField(this.m_UIRequiresPersistentWiFi, EditorGUIUtility.TextContent("PlayerSettings.UIRequiresPersistentWiFi"), new GUILayoutOption[0]);
                            GUI.enabled = (this.m_IPhoneSdkVersion != null) && (this.m_IPhoneSdkVersion.intValue >= 10);
                            EditorGUILayout.PropertyField(this.m_UIExitOnSuspend, EditorGUIUtility.TextContent("PlayerSettings.UIExitOnSuspend"), new GUILayoutOption[0]);
                            GUI.enabled = true;
                        }
                        if (targetGroup == BuildTargetGroup.Android)
                        {
                            EditorGUI.BeginChangeCheck();
                            bool boolValue = this.m_ForceInternetPermission.boolValue;
                            string[] displayedOptions = new string[] { "Auto", "Require" };
                            boolValue = EditorGUILayout.Popup(EditorGUIUtility.TextContent("PlayerSettings.ForceInternetPermission").text, !boolValue ? 0 : 1, displayedOptions, new GUILayoutOption[0]) == 1;
                            if (EditorGUI.EndChangeCheck())
                            {
                                this.m_ForceInternetPermission.boolValue = boolValue;
                            }
                            EditorGUI.BeginChangeCheck();
                            bool flag6 = this.m_ForceSDCardPermission.boolValue;
                            string[] textArray2 = new string[] { "Internal Only", "External (SDCard)" };
                            flag6 = EditorGUILayout.Popup(EditorGUIUtility.TextContent("PlayerSettings.ForceSDCardPermission").text, !flag6 ? 0 : 1, textArray2, new GUILayoutOption[0]) == 1;
                            if (EditorGUI.EndChangeCheck())
                            {
                                this.m_ForceSDCardPermission.boolValue = flag6;
                            }
                            if (Unsupported.IsDeveloperBuild())
                            {
                                EditorGUILayout.PropertyField(this.m_CreateWallpaper, EditorGUIUtility.TextContent("PlayerSettings.CreateWallpaper"), new GUILayoutOption[0]);
                            }
                        }
                    }
                    EditorGUILayout.LabelField(EditorGUIUtility.TextContent("PlayerSettings.scriptingDefineSymbols"), new GUILayoutOption[0]);
                    EditorGUI.BeginChangeCheck();
                    string defines = EditorGUILayout.DelayedTextField(PlayerSettings.GetScriptingDefineSymbolsForGroup(targetGroup), null, EditorStyles.textField, new GUILayoutOption[0]);
                    this.scriptingDefinesControlID = EditorGUI.lastControlID;
                    if (EditorGUI.EndChangeCheck())
                    {
                        PlayerSettings.SetScriptingDefineSymbolsForGroup(targetGroup, defines);
                    }
                    EditorGUILayout.Space();
                }
                if (targetGroup == BuildTargetGroup.Wii)
                {
                    this.OtherSectionGUIWii();
                }
                GUILayout.Label(EditorGUIUtility.TextContent("PlayerSettings.OptimizationSubHeader"), EditorStyles.boldLabel, new GUILayoutOption[0]);
                if (targetGroup == BuildTargetGroup.WebPlayer)
                {
                    this.ShowDisabledFakeEnumPopup(FakeEnum.WebplayerSubset);
                }
                else if (targetGroup == BuildTargetGroup.FlashPlayer)
                {
                    this.ShowDisabledFakeEnumPopup(FakeEnum.FlashPlayerSubset);
                    EditorGUILayout.PropertyField(this.m_FlashStrippingLevel, EditorGUIUtility.TextContent("PlayerSettings.flashStrippingLevel"), new GUILayoutOption[0]);
                }
                else
                {
                    EditorGUILayout.PropertyField(this.m_ApiCompatibilityLevel, new GUILayoutOption[0]);
                }
                if ((targetGroup == BuildTargetGroup.NaCl) || (targetGroup == BuildTargetGroup.FlashPlayer))
                {
                    EditorGUILayout.PropertyField(this.m_StripPhysics, EditorGUIUtility.TextContent("PlayerSettings.StripPhysics"), new GUILayoutOption[0]);
                }
                if (((targetGroup == BuildTargetGroup.iPhone) || (targetGroup == BuildTargetGroup.XBOX360)) || (targetGroup == BuildTargetGroup.PS3))
                {
                    EditorGUILayout.PropertyField(this.m_AotOptions, EditorGUIUtility.TextContent("PlayerSettings.aotOptions"), new GUILayoutOption[0]);
                }
                if (((targetGroup == BuildTargetGroup.iPhone) || (targetGroup == BuildTargetGroup.Android)) || ((targetGroup == BuildTargetGroup.PS3) || (targetGroup == BuildTargetGroup.XBOX360)))
                {
                    if (targetGroup == BuildTargetGroup.iPhone)
                    {
                        EditorGUILayout.PropertyField(this.m_IPhoneSdkVersion, EditorGUIUtility.TextContent("PlayerSettings.IPhoneSdkVersion"), new GUILayoutOption[0]);
                        EditorGUILayout.PropertyField(this.m_IPhoneTargetOSVersion, EditorGUIUtility.TextContent("PlayerSettings.IPhoneTargetOSVersion"), new GUILayoutOption[0]);
                    }
                    if (InternalEditorUtility.HasAdvancedLicenseOnBuildTarget(platform.DefaultTarget))
                    {
                        EditorGUILayout.PropertyField(this.m_IPhoneStrippingLevel, EditorGUIUtility.TextContent("PlayerSettings.IPhoneStrippingLevel"), new GUILayoutOption[0]);
                    }
                    else
                    {
                        EditorGUI.BeginDisabledGroup(true);
                        int[] optionValues = new int[1];
                        GUIContent[] contentArray = new GUIContent[] { new GUIContent("Disabled") };
                        EditorGUILayout.IntPopup(EditorGUIUtility.TextContent("PlayerSettings.IPhoneStrippingLevel"), 0, contentArray, optionValues, new GUILayoutOption[0]);
                        EditorGUI.EndDisabledGroup();
                    }
                    if (targetGroup == BuildTargetGroup.iPhone)
                    {
                        EditorGUILayout.PropertyField(this.m_IPhoneScriptCallOptimization, EditorGUIUtility.TextContent("PlayerSettings.IPhoneScriptCallOptimization"), new GUILayoutOption[0]);
                    }
                    if (targetGroup == BuildTargetGroup.Android)
                    {
                        EditorGUILayout.PropertyField(this.m_AndroidProfiler, EditorGUIUtility.TextContent("PlayerSettings.AndroidProfiler"), new GUILayoutOption[0]);
                    }
                    EditorGUILayout.Space();
                }
                EditorGUILayout.PropertyField(this.m_StripUnusedMeshComponents, EditorGUIUtility.TextContent("PlayerSettings.StripUnusedMeshComponents"), new GUILayoutOption[0]);
                EditorGUILayout.Space();
                this.ShowSharedNote();
            }
            this.EndSettingsBox();
        }

        public void OtherSectionGUIWii()
        {
            GUILayout.Label(EditorGUIUtility.TextContent("PlayerSettings.wiiControllers"), EditorStyles.boldLabel, new GUILayoutOption[0]);
            EditorGUILayout.PropertyField(this.m_WiiSupportsNunchuk, EditorGUIUtility.TextContent("PlayerSettings.wiiSupportsNunchuk"), new GUILayoutOption[0]);
            EditorGUILayout.PropertyField(this.m_WiiSupportsClassicController, EditorGUIUtility.TextContent("PlayerSettings.wiiSupportsClassicController"), new GUILayoutOption[0]);
            EditorGUILayout.PropertyField(this.m_WiiSupportsBalanceBoard, EditorGUIUtility.TextContent("PlayerSettings.wiiSupportsBalanceBoard"), new GUILayoutOption[0]);
            EditorGUILayout.PropertyField(this.m_WiiSupportsMotionPlus, EditorGUIUtility.TextContent("PlayerSettings.wiiSupportsMotionPlus"), new GUILayoutOption[0]);
            int num = EditorGUILayout.IntField(EditorGUIUtility.TextContent("PlayerSettings.wiiControllerCount"), this.m_WiiControllerCount.intValue, new GUILayoutOption[0]);
            this.m_WiiControllerCount.intValue = Mathf.Clamp(num, 1, 4);
            EditorGUILayout.Space();
            GUILayout.Label(EditorGUIUtility.TextContent("PlayerSettings.wiiMemory"), EditorStyles.boldLabel, new GUILayoutOption[0]);
            if (GUILayout.Button(EditorGUIUtility.TextContent("PlayerSettings.wiiMemoryReset"), new GUILayoutOption[0]))
            {
                PlayerSettings.Wii.ResetMemoryAreas();
            }
            GUILayoutOption[] options = new GUILayoutOption[] { GUILayout.MinHeight(200f) };
            this.memSetupScrollPosition = GUILayout.BeginScrollView(this.memSetupScrollPosition, options);
            string[] texts = new string[] { "MEM1", "MEM2" };
            WiiMemoryLabel[] collection = new WiiMemoryLabel[] { WiiMemoryLabel.WiiDefault1, WiiMemoryLabel.WiiDefault2, WiiMemoryLabel.WiiRVLAux1, WiiMemoryLabel.WiiRVLAux2, WiiMemoryLabel.WiiInput, WiiMemoryLabel.WiiVI, WiiMemoryLabel.Mono, WiiMemoryLabel.MonoCode };
            List<WiiMemoryLabel> list = new List<WiiMemoryLabel>(collection);
            bool enabled = GUI.enabled;
            IEnumerator enumerator = Enum.GetValues(typeof(WiiMemoryLabel)).GetEnumerator();
            try
            {
                while (enumerator.MoveNext())
                {
                    WiiMemoryLabel current = (WiiMemoryLabel) ((int) enumerator.Current);
                    GUILayout.BeginHorizontal(new GUILayoutOption[0]);
                    GUILayoutOption[] optionArray2 = new GUILayoutOption[] { GUILayout.MinWidth(150f) };
                    GUILayout.Label(current.ToString(), optionArray2);
                    if (list.Contains(current))
                    {
                        GUI.enabled = false;
                    }
                    int selected = (PlayerSettings.Wii.GetMemoryArea(current) != WiiMemoryArea.One) ? 1 : 0;
                    int num3 = GUILayout.SelectionGrid(selected, texts, 2, new GUILayoutOption[0]);
                    if (list.Contains(current))
                    {
                        GUI.enabled = enabled;
                    }
                    if (selected != num3)
                    {
                        PlayerSettings.Wii.SetMemoryArea(current, (num3 != 0) ? WiiMemoryArea.Two : WiiMemoryArea.One);
                    }
                    GUILayout.EndHorizontal();
                }
            }
            finally
            {
                IDisposable disposable = enumerator as IDisposable;
                if (disposable == null)
                {
                }
                disposable.Dispose();
            }
            GUI.enabled = enabled;
            GUILayout.EndScrollView();
            EditorGUILayout.Space();
            GUILayout.Label(EditorGUIUtility.TextContent("PlayerSettings.wiiLoadingScreen"), EditorStyles.boldLabel, new GUILayoutOption[0]);
            EditorGUILayout.PropertyField(this.m_WiiLoadingScreenFileName, EditorGUIUtility.TextContent("PlayerSettings.wiiLoadingScreenFileName"), new GUILayoutOption[0]);
            EditorGUILayout.PropertyField(this.m_WiiLoadingScreenPeriod, EditorGUIUtility.TextContent("PlayerSettings.wiiLoadingScreenPeriod"), new GUILayoutOption[0]);
            EditorGUILayout.PropertyField(this.m_WiiLoadingScreenRectPlacement, EditorGUIUtility.TextContent("PlayerSettings.wiiLoadingScreenRectPlacement"), new GUILayoutOption[0]);
            EditorGUILayout.PropertyField(this.m_WiiLoadingScreenRect, EditorGUIUtility.TextContent("PlayerSettings.wiiLoadingScreenRect"), new GUILayoutOption[0]);
            EditorGUILayout.PropertyField(this.m_WiiLoadingScreenBackground, EditorGUIUtility.TextContent("PlayerSettings.wiiLoadingScreenBackground"), new GUILayoutOption[0]);
            GUILayout.Label(EditorGUIUtility.TextContent("PlayerSettings.wiiMisc"), EditorStyles.boldLabel, new GUILayoutOption[0]);
            EditorGUILayout.PropertyField(this.m_WiiFloatingPointExceptions, EditorGUIUtility.TextContent("PlayerSettings.wiiFloatingPointExceptions"), new GUILayoutOption[0]);
            EditorGUILayout.PropertyField(this.m_WiiScreenCrashDumps, EditorGUIUtility.TextContent("PlayerSettings.wiiScreenCrashDumps"), new GUILayoutOption[0]);
            EditorGUILayout.PropertyField(this.m_WiiHio2Usage, EditorGUIUtility.TextContent("PlayerSettings.wiiHio2Usage"), new GUILayoutOption[0]);
            EditorGUILayout.Space();
        }

        private static string PrettyTemplateKeyName(string name)
        {
            char[] separator = new char[] { '_' };
            string[] strArray = name.Split(separator);
            strArray[0] = UppercaseFirst(strArray[0].ToLower());
            for (int i = 1; i < strArray.Length; i++)
            {
                strArray[i] = strArray[i].ToLower();
            }
            return string.Join(" ", strArray);
        }

        public void PublishSectionGUI(int selectedPlatform)
        {
            BuildPlayerWindow.BuildPlatform platform = this.validPlatforms[selectedPlatform];
            BuildTargetGroup targetGroup = platform.targetGroup;
            if (((targetGroup == BuildTargetGroup.Wii) || (targetGroup == BuildTargetGroup.Android)) || ((targetGroup == BuildTargetGroup.XBOX360) || (targetGroup == BuildTargetGroup.PS3)))
            {
                GUI.changed = false;
                if (this.BeginSettingsBox(4, EditorGUIUtility.TextContent("PlayerSettings.PublishingHeader")))
                {
                    Rect rect;
                    string str = "Assets";
                    string directory = FileUtil.DeleteLastPathNameComponent(Application.dataPath);
                    float minH = 16f;
                    float minW = (80f + EditorGUI.kNumberW) + 5f;
                    float maxW = (80f + EditorGUI.kNumberW) + 5f;
                    switch (targetGroup)
                    {
                        case BuildTargetGroup.Wii:
                            this.PublishSectionGUIWii(minW, maxW, minH, minH);
                            break;

                        case BuildTargetGroup.PS3:
                        {
                            string path = Path.Combine(Application.dataPath, "PS3 Submission Package");
                            if (Directory.Exists(path))
                            {
                                this.AutoAssignProperty(this.m_PS3TitleConfigPath, path, "TITLECONFIG.XML");
                                this.AutoAssignProperty(this.m_PS3DLCConfigPath, path, "DLCconfig.txt");
                                this.AutoAssignProperty(this.m_PS3ThumbnailPath, path, "ICON0.PNG");
                                this.AutoAssignProperty(this.m_PS3BackgroundPath, path, "BACKGROUND0.PNG");
                                this.AutoAssignProperty(this.m_PS3TrophyPackagePath, path, "TROPHY.TRP");
                                this.AutoAssignProperty(this.m_PS3SoundPath, path, "SDN0.AT3");
                            }
                            else
                            {
                                path = str;
                            }
                            this.ShowBrowseableProperty(this.m_PS3TitleConfigPath, "PlayerSettings.ps3TitleConfigPath", "xml", path, minW, maxW, minH);
                            this.ShowBrowseableProperty(this.m_PS3DLCConfigPath, "PlayerSettings.ps3DLCConfigPath", "txt", path, minW, maxW, minH);
                            this.ShowBrowseableProperty(this.m_PS3ThumbnailPath, "PlayerSettings.ps3ThumbnailPath", "png", path, minW, maxW, minH);
                            this.ShowBrowseableProperty(this.m_PS3BackgroundPath, "PlayerSettings.ps3BackgroundPath", "png", path, minW, maxW, minH);
                            this.ShowBrowseableProperty(this.m_PS3SoundPath, "PlayerSettings.ps3SoundPath", "at3", path, minW, maxW, minH);
                            GUILayout.Label(EditorGUIUtility.TextContent("PlayerSettings.ps3TrophyPackagePath"), EditorStyles.boldLabel, new GUILayoutOption[0]);
                            this.ShowBrowseableProperty(this.m_PS3TrophyPackagePath, string.Empty, "trp", path, minW, maxW, minH);
                            EditorGUILayout.PropertyField(this.m_PS3TrophyCommId, EditorGUIUtility.TextContent("PlayerSettings.ps3TrophyCommId"), new GUILayoutOption[0]);
                            GUILayoutOption[] options = new GUILayoutOption[] { GUILayout.Height(280f) };
                            this.m_PS3TrophyCommSig.stringValue = EditorGUILayout.TextField(EditorGUIUtility.TextContent("PlayerSettings.ps3TrophyCommSig"), this.m_PS3TrophyCommSig.stringValue, options);
                            GUILayout.Label(EditorGUIUtility.TextContent("PlayerSettings.ps3TitleSettings"), EditorStyles.boldLabel, new GUILayoutOption[0]);
                            EditorGUILayout.PropertyField(this.m_PS3TrialMode, EditorGUIUtility.TextContent("PlayerSettings.ps3TrialMode"), new GUILayoutOption[0]);
                            this.m_PS3BootCheckMaxSaveGameSizeKB.intValue = EditorGUILayout.IntField(EditorGUIUtility.TextContent("PlayerSettings.ps3BootCheckMaxSaveGameSizeKB"), this.m_PS3BootCheckMaxSaveGameSizeKB.intValue, new GUILayoutOption[0]);
                            this.m_PS3SaveGameSlots.intValue = EditorGUILayout.IntField(EditorGUIUtility.TextContent("PlayerSettings.ps3SaveGameSlots"), this.m_PS3SaveGameSlots.intValue, new GUILayoutOption[0]);
                            break;
                        }
                        case BuildTargetGroup.XBOX360:
                        {
                            this.m_XboxAdditionalTitleMemorySize = base.serializedObject.FindProperty("xboxAdditionalTitleMemorySize");
                            this.m_XboxAdditionalTitleMemorySize.intValue = (int) EditorGUILayout.Slider(EditorGUIUtility.TextContent("PlayerSettings.XboxAdditionalTitleMemorySize"), (float) this.m_XboxAdditionalTitleMemorySize.intValue, 0f, 416f, new GUILayoutOption[0]);
                            if (this.m_XboxAdditionalTitleMemorySize.intValue > 0)
                            {
                                ShowWarning(EditorGUIUtility.TextContent("PlayerSettings.XboxAdditionalTitleMemoryWarning"));
                            }
                            GUILayout.Label(EditorGUIUtility.TextContent("PlayerSettings.SubmissionSubHeader"), EditorStyles.boldLabel, new GUILayoutOption[0]);
                            EditorGUILayout.PropertyField(this.m_XboxTitleId, EditorGUIUtility.TextContent("PlayerSettings.XboxTitleId"), new GUILayoutOption[0]);
                            EditorGUILayout.Space();
                            GUILayout.Label(EditorGUIUtility.TextContent("PlayerSettings.XboxImageConversion"), EditorStyles.boldLabel, new GUILayoutOption[0]);
                            rect = GUILayoutUtility.GetRect(minW, maxW, minH, minH, EditorStyles.layerMaskField, null);
                            float labelWidth = EditorGUIUtility.labelWidth;
                            Rect position = new Rect(rect.x + EditorGUI.indent, rect.y, labelWidth - EditorGUI.indent, rect.height);
                            Rect rect3 = new Rect(rect.x + labelWidth, rect.y, rect.width - labelWidth, rect.height);
                            string text = (this.m_XboxImageXexPath.stringValue.Length != 0) ? this.m_XboxImageXexPath.stringValue : "Not selected.";
                            EditorGUI.TextArea(rect3, text, EditorStyles.label);
                            if (GUI.Button(position, EditorGUIUtility.TextContent("PlayerSettings.XboxImageXEXFile")))
                            {
                                string projectRelativePath = EditorUtility.OpenFilePanel(EditorGUIUtility.TextContent("PlayerSettings.XboxImageXEXFile").text, directory, "cfg");
                                this.m_XboxImageXexPath.stringValue = projectRelativePath;
                                projectRelativePath = FileUtil.GetProjectRelativePath(projectRelativePath);
                                if (projectRelativePath != string.Empty)
                                {
                                    this.m_XboxImageXexPath.stringValue = projectRelativePath;
                                }
                                base.serializedObject.ApplyModifiedProperties();
                                GUIUtility.ExitGUI();
                            }
                            EditorGUILayout.Space();
                            GUILayout.Label(EditorGUIUtility.TextContent("PlayerSettings.XboxLive"), EditorStyles.boldLabel, new GUILayoutOption[0]);
                            rect = GUILayoutUtility.GetRect(minW, maxW, minH, minH, EditorStyles.layerMaskField, null);
                            float num5 = EditorGUIUtility.labelWidth;
                            Rect rect4 = new Rect(rect.x + EditorGUI.indent, rect.y, num5 - EditorGUI.indent, rect.height);
                            Rect rect5 = new Rect(rect.x + num5, rect.y, rect.width - num5, rect.height);
                            string str6 = (this.m_XboxSpaPath.stringValue.Length != 0) ? this.m_XboxSpaPath.stringValue : "Not selected.";
                            EditorGUI.TextArea(rect5, str6, EditorStyles.label);
                            if (GUI.Button(rect4, EditorGUIUtility.TextContent("PlayerSettings.XboxSpaFile")))
                            {
                                string str7 = EditorUtility.OpenFilePanel(EditorGUIUtility.TextContent("PlayerSettings.XboxSpaFile").text, directory, "spa");
                                this.m_XboxSpaPath.stringValue = str7;
                                str7 = FileUtil.GetProjectRelativePath(str7);
                                if (str7 != string.Empty)
                                {
                                    this.m_XboxSpaPath.stringValue = str7;
                                }
                                if (this.m_XboxTitleId.stringValue.Length == 0)
                                {
                                    Debug.LogWarning("Title id must be present when using a SPA file.");
                                }
                                base.serializedObject.ApplyModifiedProperties();
                                GUIUtility.ExitGUI();
                            }
                            if (this.m_XboxSpaPath.stringValue.Length > 0)
                            {
                                bool boolValue = this.m_XboxGenerateSpa.boolValue;
                                this.m_XboxGenerateSpa.boolValue = EditorGUILayout.Toggle(EditorGUIUtility.TextContent("PlayerSettings.XboxGenerateSPAConfig"), boolValue, new GUILayoutOption[0]);
                                if (!boolValue && this.m_XboxGenerateSpa.boolValue)
                                {
                                    InternalEditorUtility.Xbox360GenerateSPAConfig(this.m_XboxSpaPath.stringValue);
                                }
                            }
                            EditorGUILayout.Space();
                            GUILayout.Label(EditorGUIUtility.TextContent("PlayerSettings.XboxServices"), EditorStyles.boldLabel, new GUILayoutOption[0]);
                            this.m_XboxEnableAvatar.boolValue = EditorGUILayout.Toggle(EditorGUIUtility.TextContent("PlayerSettings.XboxAvatarEnable"), this.m_XboxEnableAvatar.boolValue, new GUILayoutOption[0]);
                            GUILayout.Label(EditorGUIUtility.TextContent("PlayerSettings.XboxKinect"), EditorStyles.boldLabel, new GUILayoutOption[0]);
                            this.m_XboxDeployKinectResources.boolValue = EditorGUILayout.Toggle(EditorGUIUtility.TextContent("PlayerSettings.XboxKinectDeployResources"), this.m_XboxDeployKinectResources.boolValue, new GUILayoutOption[0]);
                            if (this.m_XboxDeployKinectResources.boolValue)
                            {
                                this.m_XboxEnableSpeech.boolValue = EditorGUILayout.Toggle(EditorGUIUtility.TextContent("PlayerSettings.XboxKinectSpeech"), this.m_XboxEnableSpeech.boolValue, new GUILayoutOption[0]);
                                if (this.m_XboxEnableSpeech.boolValue)
                                {
                                    GUILayout.BeginHorizontal(new GUILayoutOption[0]);
                                    GUILayout.Space(10f);
                                    this.m_XboxSpeechDB.intValue ^= (GUILayout.Toggle((this.m_XboxSpeechDB.intValue & 1) != 0, new GUIContent("en-US", "Speech database: English - US, Canada"), new GUILayoutOption[0]) == ((this.m_XboxSpeechDB.intValue & 1) != 0)) ? 0 : 1;
                                    this.m_XboxSpeechDB.intValue ^= (GUILayout.Toggle((this.m_XboxSpeechDB.intValue & 2) != 0, new GUIContent("fr-CA", "Speech database: French - Canada"), new GUILayoutOption[0]) == ((this.m_XboxSpeechDB.intValue & 2) != 0)) ? 0 : 2;
                                    this.m_XboxSpeechDB.intValue ^= (GUILayout.Toggle((this.m_XboxSpeechDB.intValue & 4) != 0, new GUIContent("en-GB", "Speech database: English - United Kingdom, Ireland"), new GUILayoutOption[0]) == ((this.m_XboxSpeechDB.intValue & 4) != 0)) ? 0 : 4;
                                    this.m_XboxSpeechDB.intValue ^= (GUILayout.Toggle((this.m_XboxSpeechDB.intValue & 8) != 0, new GUIContent("es-MX", "Speech database: Spanish - Mexico"), new GUILayoutOption[0]) == ((this.m_XboxSpeechDB.intValue & 8) != 0)) ? 0 : 8;
                                    this.m_XboxSpeechDB.intValue ^= (GUILayout.Toggle((this.m_XboxSpeechDB.intValue & 0x10) != 0, new GUIContent("ja-JP", "Speech database: Japanese - Japan"), new GUILayoutOption[0]) == ((this.m_XboxSpeechDB.intValue & 0x10) != 0)) ? 0 : 0x10;
                                    GUILayout.EndHorizontal();
                                    GUILayout.BeginHorizontal(new GUILayoutOption[0]);
                                    GUILayout.Space(10f);
                                    this.m_XboxSpeechDB.intValue ^= (GUILayout.Toggle((this.m_XboxSpeechDB.intValue & 0x20) != 0, new GUIContent("fr-FR", "Speech database: French - France, Switzerland"), new GUILayoutOption[0]) == ((this.m_XboxSpeechDB.intValue & 0x20) != 0)) ? 0 : 0x20;
                                    this.m_XboxSpeechDB.intValue ^= (GUILayout.Toggle((this.m_XboxSpeechDB.intValue & 0x40) != 0, new GUIContent("es-ES", "Speech database: Spanish - Spain"), new GUILayoutOption[0]) == ((this.m_XboxSpeechDB.intValue & 0x40) != 0)) ? 0 : 0x40;
                                    this.m_XboxSpeechDB.intValue ^= (GUILayout.Toggle((this.m_XboxSpeechDB.intValue & 0x80) != 0, new GUIContent("de-DE", "Speech database: German - Germany, Austria, Switzerland"), new GUILayoutOption[0]) == ((this.m_XboxSpeechDB.intValue & 0x80) != 0)) ? 0 : 0x80;
                                    this.m_XboxSpeechDB.intValue ^= (GUILayout.Toggle((this.m_XboxSpeechDB.intValue & 0x100) != 0, new GUIContent("it-IT", "Speech database: Italian - Italy"), new GUILayoutOption[0]) == ((this.m_XboxSpeechDB.intValue & 0x100) != 0)) ? 0 : 0x100;
                                    this.m_XboxSpeechDB.intValue ^= (GUILayout.Toggle((this.m_XboxSpeechDB.intValue & 0x200) != 0, new GUIContent("en-AU", "Speech database: English - Australia, New Zealand"), new GUILayoutOption[0]) == ((this.m_XboxSpeechDB.intValue & 0x200) != 0)) ? 0 : 0x200;
                                    GUILayout.EndHorizontal();
                                    GUILayout.BeginHorizontal(new GUILayoutOption[0]);
                                    GUILayout.Space(10f);
                                    this.m_XboxSpeechDB.intValue ^= (GUILayout.Toggle((this.m_XboxSpeechDB.intValue & 0x400) != 0, new GUIContent("pt-BR", "Speech database: Portuguese - Brazil"), new GUILayoutOption[0]) == ((this.m_XboxSpeechDB.intValue & 0x400) != 0)) ? 0 : 0x400;
                                    GUILayout.EndHorizontal();
                                }
                            }
                            this.m_XboxEnableKinect.boolValue = EditorGUILayout.Toggle(EditorGUIUtility.TextContent("PlayerSettings.XboxEnableKinect"), this.m_XboxEnableKinect.boolValue, new GUILayoutOption[0]);
                            if (this.m_XboxEnableKinect.boolValue)
                            {
                                this.m_XboxEnableKinectAutoTracking.boolValue = EditorGUILayout.Toggle(EditorGUIUtility.TextContent("PlayerSettings.XboxKinectAutoTracking"), this.m_XboxEnableKinectAutoTracking.boolValue, new GUILayoutOption[0]);
                                this.m_XboxEnableFitness.boolValue = EditorGUILayout.Toggle(EditorGUIUtility.TextContent("PlayerSettings.XboxEnableFitness"), this.m_XboxEnableFitness.boolValue, new GUILayoutOption[0]);
                            }
                            break;
                        }
                    }
                    if (targetGroup == BuildTargetGroup.Android)
                    {
                        string keystorePass = PlayerSettings.keystorePass;
                        string keyaliasPass = PlayerSettings.keyaliasPass;
                        bool flag2 = false;
                        GUILayout.Label(EditorGUIUtility.TextContent("PlayerSettings.KeystoreSubHeader"), EditorStyles.boldLabel, new GUILayoutOption[0]);
                        rect = GUILayoutUtility.GetRect(minW, maxW, minH + 5f, minH + 5f, EditorStyles.layerMaskField, null);
                        GUIContent[] contents = new GUIContent[] { EditorGUIUtility.TextContent("PlayerSettings.UseExistingKeystore"), EditorGUIUtility.TextContent("PlayerSettings.CreateNewKeystore") };
                        bool flag3 = GUI.SelectionGrid(rect, !this.m_KeystoreCreate ? 0 : 1, contents, 2, "toggle") == 1;
                        if (flag3 != this.m_KeystoreCreate)
                        {
                            this.m_KeystoreCreate = flag3;
                            this.m_AndroidKeystoreName.stringValue = string.Empty;
                            this.m_AndroidKeyaliasName.stringValue = string.Empty;
                            this.m_KeystoreAvailableKeys = null;
                        }
                        rect = GUILayoutUtility.GetRect(minW, maxW, minH, minH, EditorStyles.layerMaskField, null);
                        GUIContent content = null;
                        if (this.m_AndroidKeystoreName.stringValue.Length == 0)
                        {
                            content = EditorGUIUtility.TextContent("PlayerSettings.BrowseToSelectKeystoreName");
                            EditorGUI.BeginDisabledGroup(true);
                        }
                        else
                        {
                            content = EditorGUIUtility.TempContent(this.m_AndroidKeystoreName.stringValue);
                            EditorGUI.BeginDisabledGroup(false);
                        }
                        float num6 = EditorGUIUtility.labelWidth;
                        Rect rect6 = new Rect(rect.x + EditorGUI.indent, rect.y, num6 - EditorGUI.indent, rect.height);
                        Rect rect7 = new Rect(rect.x + num6, rect.y, rect.width - num6, rect.height);
                        EditorGUI.TextArea(rect7, content.text, EditorStyles.label);
                        EditorGUI.EndDisabledGroup();
                        if (GUI.Button(rect6, EditorGUIUtility.TextContent("PlayerSettings.BrowseKeystore")))
                        {
                            this.m_KeystoreAvailableKeys = null;
                            string currentDirectory = Directory.GetCurrentDirectory();
                            if (this.m_KeystoreCreate)
                            {
                                this.m_AndroidKeystoreName.stringValue = EditorUtility.SaveFilePanel(EditorGUIUtility.TextContent("PlayerSettings.CreateKeystoreDialog").text, currentDirectory, "user.keystore", "keystore");
                            }
                            else
                            {
                                this.m_AndroidKeystoreName.stringValue = EditorUtility.OpenFilePanel(EditorGUIUtility.TextContent("PlayerSettings.OpenKeystoreDialog").text, currentDirectory, "keystore");
                            }
                            if (this.m_KeystoreCreate && File.Exists(this.m_AndroidKeystoreName.stringValue))
                            {
                                FileUtil.DeleteFileOrDirectory(this.m_AndroidKeystoreName.stringValue);
                            }
                            currentDirectory = currentDirectory + Path.DirectorySeparatorChar;
                            if (this.m_AndroidKeystoreName.stringValue.StartsWith(currentDirectory))
                            {
                                this.m_AndroidKeystoreName.stringValue = this.m_AndroidKeystoreName.stringValue.Substring(currentDirectory.Length);
                            }
                            base.serializedObject.ApplyModifiedProperties();
                            GUIUtility.ExitGUI();
                        }
                        EditorGUI.BeginChangeCheck();
                        keystorePass = EditorGUI.PasswordField(GUILayoutUtility.GetRect(minW, maxW, minH, minH, EditorStyles.layerMaskField, null), EditorGUIUtility.TextContent("PlayerSettings.StorePass"), keystorePass);
                        if (EditorGUI.EndChangeCheck())
                        {
                            AndroidKeystoreWindow.GetAvailableKeys(string.Empty, string.Empty);
                            this.m_KeystoreAvailableKeys = null;
                        }
                        EditorGUI.BeginDisabledGroup(!this.m_KeystoreCreate);
                        rect = GUILayoutUtility.GetRect(minW, maxW, minH, minH, EditorStyles.layerMaskField, null);
                        this.m_KeystoreConfirm = EditorGUI.PasswordField(rect, EditorGUIUtility.TextContent("PlayerSettings.StoreConfirm"), this.m_KeystoreConfirm);
                        EditorGUI.EndDisabledGroup();
                        GUIContent content2 = null;
                        flag2 = false;
                        if (keystorePass.Length == 0)
                        {
                            content2 = EditorGUIUtility.TextContent("PlayerSettings.EnterPassword");
                        }
                        else if (keystorePass.Length < 6)
                        {
                            content2 = EditorGUIUtility.TextContent("PlayerSettings.PasswordTooShort");
                        }
                        else if (this.m_KeystoreCreate && (this.m_KeystoreConfirm.Length == 0))
                        {
                            content2 = EditorGUIUtility.TextContent("PlayerSettings.ConfirmPassword");
                        }
                        else if (this.m_KeystoreCreate && !keystorePass.Equals(this.m_KeystoreConfirm))
                        {
                            content2 = EditorGUIUtility.TextContent("PlayerSettings.PasswordsDoNotMatch");
                        }
                        else
                        {
                            content2 = EditorGUIUtility.TempContent(" ");
                            flag2 = true;
                        }
                        GUILayout.Label(content2, EditorStyles.miniLabel, new GUILayoutOption[0]);
                        EditorGUILayout.Space();
                        GUILayout.Label(EditorGUIUtility.TextContent("PlayerSettings.KeyaliasSubHeader"), EditorStyles.boldLabel, new GUILayoutOption[0]);
                        string[] array = new string[] { EditorGUIUtility.TextContent("PlayerSettings.KeyaliasUnsigned").text };
                        rect = GUILayoutUtility.GetRect(minW, maxW, minH, minH, EditorStyles.layerMaskField, null);
                        if (flag2 && !this.m_KeystoreCreate)
                        {
                            float num7 = EditorGUIUtility.labelWidth;
                            Rect rect8 = new Rect(rect.x + num7, rect.y, rect.width - num7, rect.height);
                            if (((Event.current.type == EventType.MouseDown) && (Event.current.button == 0)) && rect8.Contains(Event.current.mousePosition))
                            {
                                string keystore = !Path.IsPathRooted(this.m_AndroidKeystoreName.stringValue) ? Path.Combine(Directory.GetCurrentDirectory(), this.m_AndroidKeystoreName.stringValue) : this.m_AndroidKeystoreName.stringValue;
                                this.m_KeystoreAvailableKeys = AndroidKeystoreWindow.GetAvailableKeys(keystore, keystorePass);
                            }
                        }
                        else
                        {
                            AndroidKeystoreWindow.GetAvailableKeys(string.Empty, string.Empty);
                            this.m_KeystoreAvailableKeys = null;
                        }
                        int selectedIndex = 0;
                        if ((this.m_KeystoreAvailableKeys != null) && (this.m_KeystoreAvailableKeys.Length != 0))
                        {
                            ArrayUtility.AddRange<string>(ref array, this.m_KeystoreAvailableKeys);
                        }
                        else if (this.m_AndroidKeyaliasName.stringValue.Length != 0)
                        {
                            ArrayUtility.Add<string>(ref array, this.m_AndroidKeyaliasName.stringValue);
                        }
                        for (int i = 0; i < array.Length; i++)
                        {
                            if (array[i].Equals(this.m_AndroidKeyaliasName.stringValue))
                            {
                                selectedIndex = i;
                            }
                        }
                        bool flag4 = flag2 && ((this.m_KeystoreCreate && (this.m_AndroidKeystoreName.stringValue.Length != 0)) || (this.m_KeystoreAvailableKeys != null));
                        if (flag4)
                        {
                            ArrayUtility.Add<string>(ref array, string.Empty);
                            ArrayUtility.Add<string>(ref array, EditorGUIUtility.TextContent("PlayerSettings.CreateNewKey").text);
                        }
                        int num10 = EditorGUI.Popup(rect, EditorGUIUtility.TextContent("PlayerSettings.Keyalias"), selectedIndex, EditorGUIUtility.TempContent(array), EditorStyles.popup);
                        if (flag4 && (num10 == (array.Length - 1)))
                        {
                            num10 = selectedIndex;
                            this.m_KeystoreCreate = false;
                            string str12 = !Path.IsPathRooted(this.m_AndroidKeystoreName.stringValue) ? Path.Combine(Directory.GetCurrentDirectory(), this.m_AndroidKeystoreName.stringValue) : this.m_AndroidKeystoreName.stringValue;
                            AndroidKeystoreWindow.ShowAndroidKeystoreWindow(this.m_CompanyName.stringValue, str12, PlayerSettings.keystorePass);
                            GUIUtility.ExitGUI();
                        }
                        if (num10 != selectedIndex)
                        {
                            selectedIndex = num10;
                            this.m_AndroidKeyaliasName.stringValue = (selectedIndex != 0) ? array[selectedIndex] : string.Empty;
                        }
                        EditorGUI.BeginDisabledGroup(selectedIndex == 0);
                        keyaliasPass = EditorGUI.PasswordField(GUILayoutUtility.GetRect(minW, maxW, minH, minH, EditorStyles.layerMaskField, null), EditorGUIUtility.TextContent("PlayerSettings.KeyPass"), keyaliasPass);
                        EditorGUI.EndDisabledGroup();
                        GUIContent content3 = null;
                        if (selectedIndex == 0)
                        {
                            content3 = EditorGUIUtility.TempContent(" ");
                        }
                        else if (keyaliasPass.Length == 0)
                        {
                            content3 = EditorGUIUtility.TextContent("PlayerSettings.EnterPassword");
                        }
                        else if (keyaliasPass.Length < 6)
                        {
                            content3 = EditorGUIUtility.TextContent("PlayerSettings.PasswordTooShort");
                        }
                        else
                        {
                            content3 = EditorGUIUtility.TempContent(" ");
                        }
                        GUILayout.Label(content3, EditorStyles.miniLabel, new GUILayoutOption[0]);
                        PlayerSettings.keystorePass = keystorePass;
                        PlayerSettings.keyaliasPass = keyaliasPass;
                        EditorGUILayout.Space();
                        EditorGUILayout.PropertyField(this.m_APKExpansionFiles, EditorGUIUtility.TextContent("PlayerSettings.APKExpansionFiles"), new GUILayoutOption[0]);
                        EditorGUILayout.Space();
                    }
                }
                this.EndSettingsBox();
            }
        }

        public void PublishSectionGUIWii(float minW, float maxW, float minH, float maxH)
        {
            this.m_WiiRegion = base.serializedObject.FindProperty("wiiRegion");
            this.m_WiiGameCode = base.serializedObject.FindProperty("wiiGameCode");
            this.m_WiiGameVersion = base.serializedObject.FindProperty("wiiGameVersion");
            this.m_WiiCompanyCode = base.serializedObject.FindProperty("wiiCompanyCode");
            EditorGUILayout.PropertyField(this.m_WiiRegion, EditorGUIUtility.TextContent("PlayerSettings.wiiRegion"), new GUILayoutOption[0]);
            EditorGUILayout.Space();
            EditorGUILayout.PropertyField(this.m_WiiGameCode, EditorGUIUtility.TextContent("PlayerSettings.wiiGameCode"), new GUILayoutOption[0]);
            EditorGUILayout.Space();
            EditorGUILayout.PropertyField(this.m_WiiGameVersion, EditorGUIUtility.TextContent("PlayerSettings.wiiGameVersion"), new GUILayoutOption[0]);
            EditorGUILayout.Space();
            EditorGUILayout.PropertyField(this.m_WiiCompanyCode, EditorGUIUtility.TextContent("PlayerSettings.wiiCompanyCode"), new GUILayoutOption[0]);
            EditorGUILayout.Space();
        }

        public void ResolutionSectionGUI(int selectedPlatform)
        {
            GUI.changed = false;
            if (this.BeginSettingsBox(0, EditorGUIUtility.TextContent("PlayerSettings.ResolutionHeader")))
            {
                BuildPlayerWindow.BuildPlatform platform = this.validPlatforms[selectedPlatform];
                BuildTargetGroup targetGroup = platform.targetGroup;
                GUILayout.Label(EditorGUIUtility.TextContent("PlayerSettings.ResolutionSubHeader"), EditorStyles.boldLabel, new GUILayoutOption[0]);
                switch (targetGroup)
                {
                    case BuildTargetGroup.Standalone:
                        EditorGUILayout.PropertyField(this.m_DefaultScreenWidth, EditorGUIUtility.TextContent("PlayerSettings.DefaultScreenWidth"), new GUILayoutOption[0]);
                        EditorGUILayout.PropertyField(this.m_DefaultScreenHeight, EditorGUIUtility.TextContent("PlayerSettings.DefaultScreenHeight"), new GUILayoutOption[0]);
                        break;

                    case BuildTargetGroup.WebPlayer:
                    case BuildTargetGroup.FlashPlayer:
                    case BuildTargetGroup.NaCl:
                        EditorGUILayout.PropertyField(this.m_DefaultScreenWidthWeb, EditorGUIUtility.TextContent("PlayerSettings.DefaultScreenWidthWeb"), new GUILayoutOption[0]);
                        EditorGUILayout.PropertyField(this.m_DefaultScreenHeightWeb, EditorGUIUtility.TextContent("PlayerSettings.DefaultScreenHeightWeb"), new GUILayoutOption[0]);
                        break;

                    case BuildTargetGroup.XBOX360:
                        this.ShowNoSettings();
                        EditorGUILayout.Space();
                        break;

                    case BuildTargetGroup.Standalone:
                    case BuildTargetGroup.WebPlayer:
                        EditorGUILayout.PropertyField(this.m_RunInBackground, EditorGUIUtility.TextContent("PlayerSettings.RunInBackground"), new GUILayoutOption[0]);
                        break;
                }
                if ((targetGroup == BuildTargetGroup.iPhone) || (targetGroup == BuildTargetGroup.Android))
                {
                    EditorGUILayout.PropertyField(this.m_DefaultScreenOrientation, EditorGUIUtility.TextContent("PlayerSettings.DefaultScreenOrientation"), new GUILayoutOption[0]);
                    if (this.m_DefaultScreenOrientation.enumValueIndex == 4)
                    {
                        if (targetGroup == BuildTargetGroup.iPhone)
                        {
                            EditorGUILayout.PropertyField(this.m_UseOSAutoRotation, EditorGUIUtility.TextContent("PlayerSettings.UseOSAutorotation"), new GUILayoutOption[0]);
                        }
                        EditorGUI.indentLevel++;
                        GUILayout.Label(EditorGUIUtility.TextContent("PlayerSettings.AutoRotationAllowedOrientation"), EditorStyles.boldLabel, new GUILayoutOption[0]);
                        if (!(((this.m_AllowedAutoRotateToPortrait.boolValue || this.m_AllowedAutoRotateToPortraitUpsideDown.boolValue) || this.m_AllowedAutoRotateToLandscapeRight.boolValue) || this.m_AllowedAutoRotateToLandscapeLeft.boolValue))
                        {
                            this.m_AllowedAutoRotateToPortrait.boolValue = true;
                            Debug.LogError("All orientations are disabled. Allowing portrait");
                        }
                        EditorGUILayout.PropertyField(this.m_AllowedAutoRotateToPortrait, EditorGUIUtility.TextContent("PlayerSettings.PortraitOrientation"), new GUILayoutOption[0]);
                        EditorGUILayout.PropertyField(this.m_AllowedAutoRotateToPortraitUpsideDown, EditorGUIUtility.TextContent("PlayerSettings.PortraitUpsideDownOrientation"), new GUILayoutOption[0]);
                        EditorGUILayout.PropertyField(this.m_AllowedAutoRotateToLandscapeRight, EditorGUIUtility.TextContent("PlayerSettings.LandscapeRightOrientation"), new GUILayoutOption[0]);
                        EditorGUILayout.PropertyField(this.m_AllowedAutoRotateToLandscapeLeft, EditorGUIUtility.TextContent("PlayerSettings.LandscapeLeftOrientation"), new GUILayoutOption[0]);
                        EditorGUI.indentLevel--;
                    }
                    GUILayout.Label(EditorGUIUtility.TextContent("PlayerSettings.StatusBarSubHeader"), EditorStyles.boldLabel, new GUILayoutOption[0]);
                    EditorGUILayout.PropertyField(this.m_UIStatusBarHidden, EditorGUIUtility.TextContent("PlayerSettings.UIStatusBarHidden"), new GUILayoutOption[0]);
                    if (targetGroup == BuildTargetGroup.iPhone)
                    {
                        EditorGUILayout.PropertyField(this.m_UIStatusBarStyle, EditorGUIUtility.TextContent("PlayerSettings.UIStatusBarStyle"), new GUILayoutOption[0]);
                        EditorGUILayout.Space();
                    }
                }
                EditorGUILayout.Space();
                if (targetGroup == BuildTargetGroup.Standalone)
                {
                    GUILayout.Label(EditorGUIUtility.TextContent("PlayerSettings.StandalonePlayerSubHeader"), EditorStyles.boldLabel, new GUILayoutOption[0]);
                    EditorGUILayout.PropertyField(this.m_DefaultIsFullScreen, new GUILayoutOption[0]);
                    EditorGUILayout.PropertyField(this.m_CaptureSingleScreen, new GUILayoutOption[0]);
                    EditorGUILayout.PropertyField(this.m_DisplayResolutionDialog, new GUILayoutOption[0]);
                    EditorGUILayout.PropertyField(this.m_UsePlayerLog, new GUILayoutOption[0]);
                    EditorGUILayout.PropertyField(this.m_ResizableWindow, new GUILayoutOption[0]);
                    EditorGUILayout.PropertyField(this.m_UseMacAppStoreValidation, EditorGUIUtility.TempContent("Mac App Store Validation"), new GUILayoutOption[0]);
                    EditorGUILayout.PropertyField(this.m_MacFullscreenMode, new GUILayoutOption[0]);
                    EditorGUILayout.PropertyField(this.m_SupportedAspectRatios, true, new GUILayoutOption[0]);
                    EditorGUILayout.Space();
                }
                if (targetGroup == BuildTargetGroup.WebPlayer)
                {
                    GUILayout.Label(EditorGUIUtility.TextContent("PlayerSettings.WebPlayerTemplateSubHeader"), EditorStyles.boldLabel, new GUILayoutOption[0]);
                    if (WebPlayerTemplate.TemplateGUIThumbnails.Length < 1)
                    {
                        GUILayout.Label(EditorGUIUtility.TextContent("PlayerSettings.NoTemplatesFound"), new GUILayoutOption[0]);
                    }
                    else
                    {
                        int maxRowItems = Mathf.Min((int) Mathf.Max((float) ((Screen.width - 30f) / 80f), (float) 1f), WebPlayerTemplate.TemplateGUIThumbnails.Length);
                        int num2 = Mathf.Max((int) Mathf.Ceil(((float) WebPlayerTemplate.TemplateGUIThumbnails.Length) / ((float) maxRowItems)), 1);
                        bool changed = GUI.changed;
                        GUILayoutOption[] options = new GUILayoutOption[] { GUILayout.ExpandWidth(false) };
                        this.m_WebPlayerTemplate.stringValue = WebPlayerTemplate.Templates[ThumbnailList(GUILayoutUtility.GetRect((float) (maxRowItems * 80f), (float) (num2 * 100f), options), WebPlayerTemplate.GetTemplateIndex(this.m_WebPlayerTemplate.stringValue), WebPlayerTemplate.TemplateGUIThumbnails, maxRowItems)].ToString();
                        bool flag3 = !changed && GUI.changed;
                        bool flag4 = GUI.changed;
                        GUI.changed = false;
                        foreach (string str in PlayerSettings.templateCustomKeys)
                        {
                            string templateCustomValue = PlayerSettings.GetTemplateCustomValue(str);
                            templateCustomValue = EditorGUILayout.TextField(PrettyTemplateKeyName(str), templateCustomValue, new GUILayoutOption[0]);
                            PlayerSettings.SetTemplateCustomValue(str, templateCustomValue);
                        }
                        if (GUI.changed)
                        {
                            base.serializedObject.Update();
                        }
                        GUI.changed |= flag4;
                        if (flag3)
                        {
                            GUIUtility.hotControl = 0;
                            GUIUtility.keyboardControl = 0;
                            base.serializedObject.ApplyModifiedProperties();
                            PlayerSettings.templateCustomKeys = WebPlayerTemplate.Templates[WebPlayerTemplate.GetTemplateIndex(this.m_WebPlayerTemplate.stringValue)].CustomKeys;
                            base.serializedObject.Update();
                        }
                    }
                    EditorGUILayout.Space();
                }
                if ((targetGroup == BuildTargetGroup.iPhone) || (targetGroup == BuildTargetGroup.Android))
                {
                    EditorGUILayout.PropertyField(this.m_Use32BitDisplayBuffer, EditorGUIUtility.TextContent("PlayerSettings.Use32BitDisplayBuffer"), new GUILayoutOption[0]);
                }
                if (targetGroup == BuildTargetGroup.Android)
                {
                    EditorGUILayout.PropertyField(this.m_Use24BitDepthBuffer, EditorGUIUtility.TextContent("PlayerSettings.Use24BitDepthBuffer"), new GUILayoutOption[0]);
                }
                if (targetGroup == BuildTargetGroup.iPhone)
                {
                    EditorGUILayout.PropertyField(this.m_iosShowActivityIndicatorOnLoading, EditorGUIUtility.TextContent("PlayerSettings.iosShowActivityIndicatorOnLoading"), new GUILayoutOption[0]);
                }
                if (targetGroup == BuildTargetGroup.Android)
                {
                    EditorGUILayout.PropertyField(this.m_androidShowActivityIndicatorOnLoading, EditorGUIUtility.TextContent("PlayerSettings.androidShowActivityIndicatorOnLoading"), new GUILayoutOption[0]);
                }
                if ((targetGroup == BuildTargetGroup.iPhone) || (targetGroup == BuildTargetGroup.Android))
                {
                    EditorGUILayout.Space();
                }
                this.ShowSharedNote();
            }
            this.EndSettingsBox();
        }

        private void ShowAdvancedBatchingWarning(BuildTarget target)
        {
            if (!InternalEditorUtility.HasAdvancedLicenseOnBuildTarget(target))
            {
                GUIContent content = new GUIContent("Static Batching requires " + BuildPipeline.GetBuildTargetAdvancedLicenseName(target));
                EditorGUILayout.HelpBox(content.text, MessageType.Warning);
            }
        }

        private void ShowBrowseableProperty(SerializedProperty property, string textContent, string extension, string dir, float kLabelFloatMinW, float kLabelFloatMaxW, float h)
        {
            if (textContent.Length != 0)
            {
                GUILayout.Label(EditorGUIUtility.TextContent(textContent), EditorStyles.boldLabel, new GUILayoutOption[0]);
            }
            Rect rect = GUILayoutUtility.GetRect(kLabelFloatMinW, kLabelFloatMaxW, h, h, EditorStyles.layerMaskField, null);
            float labelWidth = EditorGUIUtility.labelWidth;
            Rect position = new Rect(rect.x + EditorGUI.indent, rect.y, labelWidth - EditorGUI.indent, rect.height);
            Rect rect3 = new Rect(rect.x + labelWidth, rect.y, rect.width - labelWidth, rect.height);
            string text = (property.stringValue.Length != 0) ? property.stringValue : "Not selected.";
            EditorGUI.TextArea(rect3, text, EditorStyles.label);
            if (GUI.Button(position, EditorGUIUtility.TextContent("PlayerSettings.BrowseGeneric")))
            {
                property.stringValue = FileUtil.GetLastPathNameComponent(EditorUtility.OpenFilePanel(EditorGUIUtility.TextContent("PlayerSettings.BrowseGeneric").text, dir, extension));
                base.serializedObject.ApplyModifiedProperties();
                GUIUtility.ExitGUI();
            }
            EditorGUILayout.Space();
        }

        private void ShowDisabledFakeEnumPopup(FakeEnum enumValue)
        {
            GUILayout.BeginHorizontal(new GUILayoutOption[0]);
            EditorGUILayout.PrefixLabel(this.m_ApiCompatibilityLevel.displayName);
            EditorGUI.BeginDisabledGroup(true);
            EditorGUILayout.EnumPopup(enumValue, new GUILayoutOption[0]);
            EditorGUI.EndDisabledGroup();
            GUILayout.EndHorizontal();
        }

        private void ShowNoSettings()
        {
            GUILayout.Label(EditorGUIUtility.TextContent("PlayerSettings.NotApplicableForPlatform"), EditorStyles.miniLabel, new GUILayoutOption[0]);
        }

        private void ShowSharedNote()
        {
            GUILayout.Label(EditorGUIUtility.TextContent("PlayerSettings.SharedSettingsFootnote"), EditorStyles.miniLabel, new GUILayoutOption[0]);
        }

        private static void ShowWarning(GUIContent warningMessage)
        {
            if (s_WarningIcon == null)
            {
                s_WarningIcon = EditorGUIUtility.LoadIcon("console.warnicon");
            }
            warningMessage.image = s_WarningIcon;
            GUILayout.Space(5f);
            GUILayout.BeginVertical(EditorStyles.helpBox, new GUILayoutOption[0]);
            GUILayout.Label(warningMessage, EditorStyles.wordWrappedMiniLabel, new GUILayoutOption[0]);
            GUILayout.EndVertical();
        }

        private void SplashSectionGUI(int selectedPlatform)
        {
            GUI.changed = false;
            if (this.BeginSettingsBox(2, EditorGUIUtility.TextContent("PlayerSettings.SplashHeader")))
            {
                BuildPlayerWindow.BuildPlatform platform = this.validPlatforms[selectedPlatform];
                BuildTargetGroup targetGroup = platform.targetGroup;
                if (targetGroup == BuildTargetGroup.Standalone)
                {
                    this.m_ResolutionDialogBanner.objectReferenceValue = EditorGUILayout.ObjectField(EditorGUIUtility.TextContent("PlayerSettings.ResolutionDialogBanner"), (Texture2D) this.m_ResolutionDialogBanner.objectReferenceValue, typeof(Texture2D), false, new GUILayoutOption[0]);
                    EditorGUILayout.Space();
                }
                if ((targetGroup == BuildTargetGroup.WebPlayer) || (targetGroup == BuildTargetGroup.FlashPlayer))
                {
                    this.ShowNoSettings();
                    EditorGUILayout.Space();
                }
                if (targetGroup == BuildTargetGroup.XBOX360)
                {
                    this.m_XboxSplashScreen.objectReferenceValue = EditorGUILayout.ObjectField(EditorGUIUtility.TextContent("PlayerSettings.XboxSplashScreen"), (Texture2D) this.m_XboxSplashScreen.objectReferenceValue, typeof(Texture2D), false, new GUILayoutOption[0]);
                    EditorGUILayout.Space();
                }
                EditorGUI.BeginDisabledGroup(!InternalEditorUtility.HasAdvancedLicenseOnBuildTarget(platform.DefaultTarget));
                if ((targetGroup == BuildTargetGroup.iPhone) || (targetGroup == BuildTargetGroup.Android))
                {
                    this.m_IPhoneSplashScreen.objectReferenceValue = EditorGUILayout.ObjectField(EditorGUIUtility.TextContent("PlayerSettings.IPhoneSplashScreen"), (Texture2D) this.m_IPhoneSplashScreen.objectReferenceValue, typeof(Texture2D), false, new GUILayoutOption[0]);
                    EditorGUILayout.Space();
                }
                switch (targetGroup)
                {
                    case BuildTargetGroup.iPhone:
                        this.m_IPhoneHighResSplashScreen.objectReferenceValue = EditorGUILayout.ObjectField(EditorGUIUtility.TextContent("PlayerSettings.IPhoneHighResSplashScreen"), (Texture2D) this.m_IPhoneHighResSplashScreen.objectReferenceValue, typeof(Texture2D), false, new GUILayoutOption[0]);
                        EditorGUILayout.Space();
                        this.m_IPhoneTallHighResSplashScreen.objectReferenceValue = EditorGUILayout.ObjectField(EditorGUIUtility.TextContent("PlayerSettings.IPhoneTallHighResSplashScreen"), (Texture2D) this.m_IPhoneTallHighResSplashScreen.objectReferenceValue, typeof(Texture2D), false, new GUILayoutOption[0]);
                        EditorGUILayout.Space();
                        this.m_IPadPortraitSplashScreen.objectReferenceValue = EditorGUILayout.ObjectField(EditorGUIUtility.TextContent("PlayerSettings.IPadPortraitSplashScreen"), (Texture2D) this.m_IPadPortraitSplashScreen.objectReferenceValue, typeof(Texture2D), false, new GUILayoutOption[0]);
                        EditorGUILayout.Space();
                        this.m_IPadHighResPortraitSplashScreen.objectReferenceValue = EditorGUILayout.ObjectField(EditorGUIUtility.TextContent("PlayerSettings.IPadHighResPortraitSplashScreen"), (Texture2D) this.m_IPadHighResPortraitSplashScreen.objectReferenceValue, typeof(Texture2D), false, new GUILayoutOption[0]);
                        EditorGUILayout.Space();
                        this.m_IPadLandscapeSplashScreen.objectReferenceValue = EditorGUILayout.ObjectField(EditorGUIUtility.TextContent("PlayerSettings.IPadLandscapeSplashScreen"), (Texture2D) this.m_IPadLandscapeSplashScreen.objectReferenceValue, typeof(Texture2D), false, new GUILayoutOption[0]);
                        EditorGUILayout.Space();
                        this.m_IPadHighResLandscapeSplashScreen.objectReferenceValue = EditorGUILayout.ObjectField(EditorGUIUtility.TextContent("PlayerSettings.IPadHighResLandscapeSplashScreen"), (Texture2D) this.m_IPadHighResLandscapeSplashScreen.objectReferenceValue, typeof(Texture2D), false, new GUILayoutOption[0]);
                        EditorGUILayout.Space();
                        break;

                    case BuildTargetGroup.Android:
                        EditorGUI.BeginDisabledGroup(this.m_IPhoneSplashScreen.objectReferenceValue == null);
                        EditorGUILayout.PropertyField(this.m_AndroidSplashScreenScale, EditorGUIUtility.TextContent("PlayerSettings.AndroidSplashScreenScale"), new GUILayoutOption[0]);
                        EditorGUI.EndDisabledGroup();
                        break;
                }
                EditorGUI.EndDisabledGroup();
                if ((targetGroup == BuildTargetGroup.iPhone) || (targetGroup == BuildTargetGroup.Android))
                {
                    this.ShowSharedNote();
                }
            }
            this.EndSettingsBox();
        }

        private static int ThumbnailList(Rect rect, int selection, GUIContent[] thumbnails, int maxRowItems)
        {
            int num = 0;
            int index = 0;
            while (index < thumbnails.Length)
            {
                int num3 = 0;
                while ((num3 < maxRowItems) && (index < thumbnails.Length))
                {
                    if (ThumbnailListItem(new Rect(rect.x + (num3 * 80f), rect.y + (num * 100f), 80f, 100f), index == selection, thumbnails[index]))
                    {
                        selection = index;
                    }
                    num3++;
                    index++;
                }
                num++;
            }
            return selection;
        }

        private static bool ThumbnailListItem(Rect rect, bool selected, GUIContent content)
        {
            EventType type = Event.current.type;
            if (type != EventType.MouseDown)
            {
                if (type != EventType.Repaint)
                {
                    return selected;
                }
            }
            else
            {
                if (rect.Contains(Event.current.mousePosition))
                {
                    if (!selected)
                    {
                        GUI.changed = true;
                    }
                    selected = true;
                    Event.current.Use();
                }
                return selected;
            }
            Rect position = new Rect(rect.x + 5f, rect.y + 5f, rect.width - 10f, (rect.height - 20f) - 10f);
            s_Styles.thumbnail.Draw(position, content.image, false, false, selected, selected);
            s_Styles.thumbnailLabel.Draw(new Rect(rect.x, (rect.y + rect.height) - 20f, rect.width, 20f), content.text, false, false, selected, selected);
            return selected;
        }

        private static string UppercaseFirst(string target)
        {
            if (string.IsNullOrEmpty(target))
            {
                return string.Empty;
            }
            return (char.ToUpper(target[0]) + target.Substring(1));
        }

        private enum FakeEnum
        {
            WebplayerSubset,
            FlashPlayerSubset
        }

        private class Styles
        {
            public GUIContent colorSpaceWarning = EditorGUIUtility.TextContent("PlayerSettings.ActiveColorSpaceWarning");
            public GUIContent cursorHotspot = EditorGUIUtility.TextContent("PlayerSettings.CursorHotspot");
            public GUIContent defaultCursor = EditorGUIUtility.TextContent("PlayerSettings.DefaultCursor");
            public GUIContent defaultIcon = EditorGUIUtility.TextContent("PlayerSettings.DefaultIcon");
            public GUIStyle thumbnail = "IN ThumbnailShadow";
            public GUIStyle thumbnailLabel = "IN ThumbnailSelection";
        }

        internal class WebPlayerTemplate
        {
            private string[] m_CustomKeys;
            private string m_Name;
            private string m_Path;
            private Texture2D m_Thumbnail;
            private static GUIContent[] s_TemplateGUIThumbnails;
            private static PlayerSettingsEditor.WebPlayerTemplate[] s_Templates;

            private static void BuildTemplateList()
            {
                List<PlayerSettingsEditor.WebPlayerTemplate> list = new List<PlayerSettingsEditor.WebPlayerTemplate>();
                string path = Path.Combine(Application.dataPath.Replace('/', Path.DirectorySeparatorChar), "WebPlayerTemplates");
                if (Directory.Exists(path))
                {
                    list.AddRange(ListTemplates(path));
                }
                string str2 = Path.Combine(Path.Combine(EditorApplication.applicationContentsPath.Replace('/', Path.DirectorySeparatorChar), "Resources"), "WebPlayerTemplates");
                if (Directory.Exists(str2))
                {
                    list.AddRange(ListTemplates(str2));
                }
                else
                {
                    Debug.LogError("Did not find built-in templates.");
                }
                s_Templates = list.ToArray();
                s_TemplateGUIThumbnails = new GUIContent[s_Templates.Length];
                for (int i = 0; i < s_TemplateGUIThumbnails.Length; i++)
                {
                    s_TemplateGUIThumbnails[i] = s_Templates[i].ToGUIContent();
                }
            }

            public static void ClearTemplates()
            {
                s_Templates = null;
                s_TemplateGUIThumbnails = null;
            }

            public override bool Equals(object other)
            {
                return ((other is PlayerSettingsEditor.WebPlayerTemplate) && other.ToString().Equals(this.ToString()));
            }

            public override int GetHashCode()
            {
                return (base.GetHashCode() ^ this.m_Path.GetHashCode());
            }

            public static int GetTemplateIndex(string path)
            {
                for (int i = 0; i < Templates.Length; i++)
                {
                    if (path.Equals(Templates[i].ToString()))
                    {
                        return i;
                    }
                }
                return 0;
            }

            private static List<PlayerSettingsEditor.WebPlayerTemplate> ListTemplates(string path)
            {
                List<PlayerSettingsEditor.WebPlayerTemplate> list = new List<PlayerSettingsEditor.WebPlayerTemplate>();
                foreach (string str in Directory.GetDirectories(path))
                {
                    PlayerSettingsEditor.WebPlayerTemplate item = Load(str);
                    if (item != null)
                    {
                        list.Add(item);
                    }
                }
                return list;
            }

            private static PlayerSettingsEditor.WebPlayerTemplate Load(string path)
            {
                if (!Directory.Exists(path) || (Directory.GetFiles(path, "index.*").Length < 1))
                {
                    return null;
                }
                char[] separator = new char[] { Path.DirectorySeparatorChar };
                string[] strArray = path.Split(separator);
                PlayerSettingsEditor.WebPlayerTemplate template = new PlayerSettingsEditor.WebPlayerTemplate {
                    m_Name = strArray[strArray.Length - 1]
                };
                if ((strArray.Length > 3) && strArray[strArray.Length - 3].Equals("Assets"))
                {
                    template.m_Path = "PROJECT:" + template.m_Name;
                }
                else
                {
                    template.m_Path = "APPLICATION:" + template.m_Name;
                }
                string[] files = Directory.GetFiles(path, "thumbnail.*");
                if (files.Length > 0)
                {
                    template.m_Thumbnail = new Texture2D(2, 2);
                    template.m_Thumbnail.LoadImage(File.ReadAllBytes(files[0]));
                }
                List<string> list = new List<string>();
                Regex regex = new Regex(@"\%UNITY_CUSTOM_([A-Z_]+)\%");
                IEnumerator enumerator = regex.Matches(File.ReadAllText(Directory.GetFiles(path, "index.*")[0])).GetEnumerator();
                try
                {
                    while (enumerator.MoveNext())
                    {
                        Match current = (Match) enumerator.Current;
                        string item = current.Value.Substring("%UNITY_CUSTOM_".Length);
                        item = item.Substring(0, item.Length - 1);
                        if (!list.Contains(item))
                        {
                            list.Add(item);
                        }
                    }
                }
                finally
                {
                    IDisposable disposable = enumerator as IDisposable;
                    if (disposable == null)
                    {
                    }
                    disposable.Dispose();
                }
                template.m_CustomKeys = list.ToArray();
                return template;
            }

            public GUIContent ToGUIContent()
            {
                return new GUIContent(this.m_Name, (this.m_Thumbnail != null) ? this.m_Thumbnail : ((Texture2D) EditorGUIUtility.IconContent("BuildSettings.Web.Small").image));
            }

            public override string ToString()
            {
                return this.m_Path;
            }

            public string[] CustomKeys
            {
                get
                {
                    return this.m_CustomKeys;
                }
            }

            public static GUIContent[] TemplateGUIThumbnails
            {
                get
                {
                    if ((s_Templates == null) || (s_TemplateGUIThumbnails == null))
                    {
                        BuildTemplateList();
                    }
                    return s_TemplateGUIThumbnails;
                }
            }

            public static PlayerSettingsEditor.WebPlayerTemplate[] Templates
            {
                get
                {
                    if ((s_Templates == null) || (s_TemplateGUIThumbnails == null))
                    {
                        BuildTemplateList();
                    }
                    return s_Templates;
                }
            }
        }
    }
}

